summaryrefslogtreecommitdiff
path: root/plugin_loader/plugin.py
diff options
context:
space:
mode:
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):