summaryrefslogtreecommitdiff
path: root/plugin_loader/plugin.py
diff options
context:
space:
mode:
authormarios <marios8543@gmail.com>2022-04-29 21:51:01 +0300
committermarios <marios8543@gmail.com>2022-04-29 21:51:01 +0300
commit89ecca7c30f3898e4b772b7c9786fa58e5bb4ada (patch)
tree1b36c97b8484cd22860e8d7289aca7466c59e53b /plugin_loader/plugin.py
parent7d74e98f4f8a47daac85b5de1ef6aa29a1637c06 (diff)
downloaddecky-loader-1.2.2.tar.gz
decky-loader-1.2.2.zip
Fixed callsign debug bug, Fixed process spawn and termination bugv1.2.2
Diffstat (limited to 'plugin_loader/plugin.py')
-rw-r--r--plugin_loader/plugin.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin_loader/plugin.py b/plugin_loader/plugin.py
index 88857797..30626058 100644
--- a/plugin_loader/plugin.py
+++ b/plugin_loader/plugin.py
@@ -2,8 +2,10 @@ from importlib.util import spec_from_file_location, module_from_spec
from asyncio import get_event_loop, new_event_loop, set_event_loop, start_unix_server, open_unix_connection, sleep, Lock
from os import path, setuid
from json import loads, dumps, load
-from concurrent.futures import ProcessPoolExecutor
from time import time
+from multiprocessing import Process
+from signal import signal, SIGINT
+from sys import exit
class PluginWrapper:
def __init__(self, file, plugin_directory, plugin_path) -> None:
@@ -25,6 +27,8 @@ class PluginWrapper:
self.passive = not path.isfile(self.file)
def _init(self):
+ signal(SIGINT, lambda s, f: exit(0))
+
set_event_loop(new_event_loop())
if self.passive:
return
@@ -73,7 +77,7 @@ class PluginWrapper:
def start(self):
if self.passive:
return self
- ProcessPoolExecutor().submit(self._init, self)
+ Process(target=self._init).start()
return self
def stop(self):