mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
Target.killall: catch TargetError on individual kills
killall() is implemented by discovering all PIDs who's name matches the specified process, and then sending individual kills for each PID. If a PID no longer exists by the time the kill is sent (e.g. if it was a child of one of the previously killed PIDs), this will result in a TargetError, which for the purposes of killall() should be ignored.
This commit is contained in:
parent
9038339373
commit
6351a3bad9
@ -351,7 +351,10 @@ class Target(object):
|
|||||||
|
|
||||||
def killall(self, process_name, signal=None, as_root=False):
|
def killall(self, process_name, signal=None, as_root=False):
|
||||||
for pid in self.get_pids_of(process_name):
|
for pid in self.get_pids_of(process_name):
|
||||||
|
try:
|
||||||
self.kill(pid, signal=signal, as_root=as_root)
|
self.kill(pid, signal=signal, as_root=as_root)
|
||||||
|
except TargetError:
|
||||||
|
pass
|
||||||
|
|
||||||
def get_pids_of(self, process_name):
|
def get_pids_of(self, process_name):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user