diff --git a/riotctrl/ctrl.py b/riotctrl/ctrl.py index dcd5248..ed277af 100644 --- a/riotctrl/ctrl.py +++ b/riotctrl/ctrl.py @@ -6,6 +6,7 @@ import abc import os import time +import signal import logging import subprocess import contextlib @@ -179,7 +180,14 @@ def stop_term(self): Handles possible exceptions. """ + if self._term_pid() is None: + return + try: + # Native will spawn more than one process, so send the signals + # to the process group instead of the process. + os.killpg(self._term_pid(), signal.SIGHUP) + os.killpg(self._term_pid(), signal.SIGINT) self.term.close() except AttributeError: # Not initialized diff --git a/setup.cfg b/setup.cfg index 63874ac..d328883 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,6 +10,7 @@ markers = [pylint] reports = no max-line-length = 88 +max-positional-arguments = 6 disable = locally-disabled,consider-using-f-string,invalid-name,too-few-public-methods msg-template = {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}