diff options
author | Devaev Maxim <[email protected]> | 2020-12-02 15:07:08 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-12-02 15:07:08 +0300 |
commit | 5bc868662a7ef2b8959a04e6678c512797ebd7be (patch) | |
tree | 102f25b53359e58a8cd42c78a5ea7f57c91f294f /kvmd | |
parent | 2b064a3bee87a13930e1212b583278ff2a8117db (diff) |
stop signals propagation in 3.9
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/aioproc.py | 8 | ||||
-rw-r--r-- | kvmd/plugins/hid/_mcu/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/hid/bt/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/hid/otg/device.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/ugpio/ezcoo.py | 2 |
5 files changed, 6 insertions, 10 deletions
diff --git a/kvmd/aioproc.py b/kvmd/aioproc.py index ecf6230e..b4b84ea4 100644 --- a/kvmd/aioproc.py +++ b/kvmd/aioproc.py @@ -20,9 +20,9 @@ # ========================================================================== # +import os import asyncio import asyncio.subprocess -import signal import logging from typing import Tuple @@ -37,7 +37,7 @@ async def run_process(cmd: List[str], err_to_null: bool=False) -> asyncio.subpro *cmd, stdout=asyncio.subprocess.PIPE, stderr=(asyncio.subprocess.DEVNULL if err_to_null else asyncio.subprocess.STDOUT), - preexec_fn=ignore_sigint, + preexec_fn=os.setpgrp, )) @@ -69,9 +69,5 @@ async def log_stdout_infinite(proc: asyncio.subprocess.Process, logger: logging. raise RuntimeError("asyncio process: too many empty lines") -def ignore_sigint() -> None: - signal.signal(signal.SIGINT, signal.SIG_IGN) - - def rename_process(suffix: str, prefix: str="kvmd") -> None: setproctitle.setproctitle(f"{prefix}/{suffix}: {setproctitle.getproctitle()}") diff --git a/kvmd/plugins/hid/_mcu/__init__.py b/kvmd/plugins/hid/_mcu/__init__.py index 4d3df434..e3234880 100644 --- a/kvmd/plugins/hid/_mcu/__init__.py +++ b/kvmd/plugins/hid/_mcu/__init__.py @@ -273,7 +273,7 @@ class BaseMcuHid(BaseHid, multiprocessing.Process): # pylint: disable=too-many- logger = get_logger(0) logger.info("Started HID pid=%d", os.getpid()) - aioproc.ignore_sigint() + os.setpgrp() aioproc.rename_process("hid") while not self.__stop_event.is_set(): diff --git a/kvmd/plugins/hid/bt/__init__.py b/kvmd/plugins/hid/bt/__init__.py index 48242bee..25c3b823 100644 --- a/kvmd/plugins/hid/bt/__init__.py +++ b/kvmd/plugins/hid/bt/__init__.py @@ -197,7 +197,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes logger = get_logger(0) logger.info("Started HID pid=%d", os.getpid()) - aioproc.ignore_sigint() + os.setpgrp() aioproc.rename_process("hid") while not self.__stop_event.is_set(): diff --git a/kvmd/plugins/hid/otg/device.py b/kvmd/plugins/hid/otg/device.py index 7d25597b..8845d9e1 100644 --- a/kvmd/plugins/hid/otg/device.py +++ b/kvmd/plugins/hid/otg/device.py @@ -81,7 +81,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in logger = get_logger(0) logger.info("Started HID-%s pid=%d", self.__name, os.getpid()) - aioproc.ignore_sigint() + os.setpgrp() aioproc.rename_process(f"hid-{self.__name}") while not self.__stop_event.is_set(): diff --git a/kvmd/plugins/ugpio/ezcoo.py b/kvmd/plugins/ugpio/ezcoo.py index bdc65d36..5c6c0e8e 100644 --- a/kvmd/plugins/ugpio/ezcoo.py +++ b/kvmd/plugins/ugpio/ezcoo.py @@ -133,7 +133,7 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute logger = get_logger(0) logger.info("Started %s pid=%d", self, os.getpid()) - aioproc.ignore_sigint() + os.setpgrp() aioproc.rename_process(f"gpio-ezcoo-{self._instance_name}") while not self.__stop_event.is_set(): |