1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

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.
This commit is contained in:
Marc Bonnici 2021-07-07 10:44:28 +01:00
parent 80c0e37d11
commit 6825130e48

View File

@ -33,8 +33,8 @@ from devlib.utils.misc import InitCheckpoint
_KILL_TIMEOUT = 3 _KILL_TIMEOUT = 3
def _kill_pgid_cmd(pgid, sig): def _kill_pgid_cmd(pgid, sig, busybox):
return 'kill -{} -{}'.format(sig.value, pgid) return '{} kill -{} -{}'.format(busybox, sig.value, pgid)
class ConnectionBase(InitCheckpoint): class ConnectionBase(InitCheckpoint):
@ -258,7 +258,7 @@ class ParamikoBackgroundCommand(BackgroundCommand):
return return
# Use -PGID to target a process group rather than just the process # Use -PGID to target a process group rather than just the process
# itself # 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) self.conn.execute(cmd, as_root=self.as_root)
@property @property
@ -322,7 +322,7 @@ class AdbBackgroundCommand(BackgroundCommand):
def send_signal(self, sig): def send_signal(self, sig):
self.conn.execute( self.conn.execute(
_kill_pgid_cmd(self.pid, sig), _kill_pgid_cmd(self.pid, sig, self.conn.busybox),
as_root=self.as_root, as_root=self.as_root,
) )