From 6825130e48b8b5bf759fa8d533db313fcaefdc25 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 7 Jul 2021 10:44:28 +0100 Subject: [PATCH] connection: Use busybox implementation of `kill` Some target implementations of kill do not support killing process groups so use the busybox implementation for greater portability. --- devlib/connection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devlib/connection.py b/devlib/connection.py index b4743f4..e5c4b2e 100644 --- a/devlib/connection.py +++ b/devlib/connection.py @@ -33,8 +33,8 @@ from devlib.utils.misc import InitCheckpoint _KILL_TIMEOUT = 3 -def _kill_pgid_cmd(pgid, sig): - return 'kill -{} -{}'.format(sig.value, pgid) +def _kill_pgid_cmd(pgid, sig, busybox): + return '{} kill -{} -{}'.format(busybox, sig.value, pgid) class ConnectionBase(InitCheckpoint): @@ -258,7 +258,7 @@ class ParamikoBackgroundCommand(BackgroundCommand): return # Use -PGID to target a process group rather than just the process # itself - cmd = _kill_pgid_cmd(self.pid, sig) + cmd = _kill_pgid_cmd(self.pid, sig, self.conn.busybox) self.conn.execute(cmd, as_root=self.as_root) @property @@ -322,7 +322,7 @@ class AdbBackgroundCommand(BackgroundCommand): def send_signal(self, sig): self.conn.execute( - _kill_pgid_cmd(self.pid, sig), + _kill_pgid_cmd(self.pid, sig, self.conn.busybox), as_root=self.as_root, )