From d636195f1bc5a8c6c34f21a2ac6123321b2216d2 Mon Sep 17 00:00:00 2001 From: crasbe Date: Sat, 26 Apr 2025 14:39:15 +0200 Subject: [PATCH 1/2] ctrl: send termination signals to the process group The native platform on RIOT spawns two processes instead of one, so that sending the termination signal to just one process might leave a stray process open. This causes a PTY leak and eventually breaks the CI servers. --- riotctrl/ctrl.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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 From 2e81d39ae815768305b446f7d53a4f44867eaf16 Mon Sep 17 00:00:00 2001 From: crasbe Date: Sat, 26 Apr 2025 15:08:03 +0200 Subject: [PATCH 2/2] ctrl: disable pylint warning for __init__ --- setup.cfg | 1 + 1 file changed, 1 insertion(+) 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}