From d6e955571b406414df0036407fc30d34e9b6281e Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 16 May 2023 17:06:15 -0500 Subject: [PATCH 1/3] connection: update kill command format The kill applet in the current busybox executable does not support the `--` syntax therefore remove from the template command. --- devlib/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/connection.py b/devlib/connection.py index aacb48a0f..2a5aabf8a 100644 --- a/devlib/connection.py +++ b/devlib/connection.py @@ -35,7 +35,7 @@ def _kill_pgid_cmd(pgid, sig, busybox): - return '{} kill -{} -- -{}'.format(busybox, sig.value, pgid) + return '{} kill -{} -{}'.format(busybox, sig.value, pgid) def _popen_communicate(bg, popen, input, timeout): try: From bf595a76366e9a850cd1f914a16e71aba7989ce4 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 16 May 2023 17:07:37 -0500 Subject: [PATCH 2/3] connection/bg_cmd: fix missing use of signal The signal parameter was being ignored and instead always sending the KILL signal instead. --- devlib/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/connection.py b/devlib/connection.py index 2a5aabf8a..dbc41f0a5 100644 --- a/devlib/connection.py +++ b/devlib/connection.py @@ -170,7 +170,7 @@ def send_signal(self, sig): :type signal: signal.Signals """ try: - self._send_signal(signal.SIGKILL) + self._send_signal(sig) finally: # Deregister if the command has finished self.poll() From 692047791d8bbf9904f2a412887c3860793da279 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Wed, 17 May 2023 10:01:39 +0100 Subject: [PATCH 3/3] connection: Make BackgroundCommand.wait() return non-None Lack of return statement in wait() was making it return None instead of the exit code. Add appropriate return statement in wait() and other function to ensure return value is not lost. --- devlib/connection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devlib/connection.py b/devlib/connection.py index dbc41f0a5..a857a57bc 100644 --- a/devlib/connection.py +++ b/devlib/connection.py @@ -170,7 +170,7 @@ def send_signal(self, sig): :type signal: signal.Signals """ try: - self._send_signal(sig) + return self._send_signal(sig) finally: # Deregister if the command has finished self.poll() @@ -188,7 +188,7 @@ def cancel(self, kill_timeout=_KILL_TIMEOUT): """ try: if self.poll() is None: - self._cancel(kill_timeout=kill_timeout) + return self._cancel(kill_timeout=kill_timeout) finally: self._deregister() @@ -208,7 +208,7 @@ def wait(self): Block until the background command completes, and return its exit code. """ try: - self._wait() + return self._wait() finally: self._deregister()