aboutsummaryrefslogtreecommitdiff
path: root/devlib/target.py
diff options
context:
space:
mode:
authorSergei Trofimov <sergei.trofimov@arm.com>2017-01-30 11:14:36 +0000
committerSergei Trofimov <sergei.trofimov@arm.com>2017-01-30 11:14:36 +0000
commit6351a3bad94687e976a355b78c9640fcaa639f2a (patch)
tree89a16ffa2a5dde97a6b6844964e3f7a5e86976ca /devlib/target.py
parent90383393732d146cd72e78465b3986d7dfe8e35f (diff)
downloaddevlib-6351a3bad94687e976a355b78c9640fcaa639f2a.tar.gz
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.
Diffstat (limited to 'devlib/target.py')
-rw-r--r--devlib/target.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/devlib/target.py b/devlib/target.py
index 88c424f..e628ab7 100644
--- a/devlib/target.py
+++ b/devlib/target.py
@@ -351,7 +351,10 @@ class Target(object):
def killall(self, process_name, signal=None, as_root=False):
for pid in self.get_pids_of(process_name):
- self.kill(pid, signal=signal, as_root=as_root)
+ try:
+ self.kill(pid, signal=signal, as_root=as_root)
+ except TargetError:
+ pass
def get_pids_of(self, process_name):
raise NotImplementedError()