diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/loader.py | 9 | ||||
| -rw-r--r-- | backend/plugin.py | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/backend/loader.py b/backend/loader.py index 493e7f10..c420fafe 100644 --- a/backend/loader.py +++ b/backend/loader.py @@ -8,7 +8,12 @@ from traceback import print_exc from aiohttp import web from genericpath import exists from watchdog.events import RegexMatchingEventHandler -from watchdog.observers.inotify import InotifyObserver as Observer +from watchdog.utils import UnsupportedLibc + +try: + from watchdog.observers.inotify import InotifyObserver as Observer +except UnsupportedLibc: + from watchdog.observers.fsevents import FSEventsObserver as Observer from injector import get_tab, inject_to_tab from plugin import PluginWrapper @@ -111,7 +116,7 @@ class Loader: self.logger.info(f"Plugin {plugin.name} is passive") self.plugins[plugin.name] = plugin.start() self.logger.info(f"Loaded {plugin.name}") - #self.loop.create_task(self.dispatch_plugin(plugin.name)) + self.loop.create_task(self.dispatch_plugin(plugin.name)) except Exception as e: self.logger.error(f"Could not load {file}. {e}") print_exc() diff --git a/backend/plugin.py b/backend/plugin.py index e6cceffd..fb636a4c 100644 --- a/backend/plugin.py +++ b/backend/plugin.py @@ -1,10 +1,10 @@ +import multiprocessing from asyncio import (Lock, get_event_loop, new_event_loop, open_unix_connection, set_event_loop, sleep, start_unix_server) from concurrent.futures import ProcessPoolExecutor from importlib.util import module_from_spec, spec_from_file_location from json import dumps, load, loads -from multiprocessing import Process from os import path, setuid from signal import SIGINT, signal from sys import exit @@ -87,7 +87,8 @@ class PluginWrapper: def start(self): if self.passive: return self - Process(target=self._init).start() + multiprocessing.set_start_method("fork") + multiprocessing.Process(target=self._init).start() return self def stop(self): |
