fix(loader): eplixcitly set process start method and import fsevents on mac

This commit is contained in:
Jonas Dellinger
2022-06-13 10:34:46 +02:00
parent bbf49470fc
commit 12f4c7faff
2 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -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()
+3 -2
View File
@@ -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):