mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-25 14:07:50 +00:00
target: conditionally raise from check_responsive
Add an option to check_responsive() to not throw an exception if unresponsive target is detected, but to act as a predicate instead.
This commit is contained in:
parent
0e017ddf9f
commit
f490a55be2
@ -440,11 +440,14 @@ class Target(object):
|
||||
pass
|
||||
self._connected_as_root = None
|
||||
|
||||
def check_responsive(self):
|
||||
def check_responsive(self, explode=True):
|
||||
try:
|
||||
self.conn.execute('ls /', timeout=5)
|
||||
return 1
|
||||
except (TimeoutError, subprocess.CalledProcessError):
|
||||
raise TargetNotRespondingError(self.conn.name)
|
||||
if explode:
|
||||
raise TargetNotRespondingError(self.conn.name)
|
||||
return 0
|
||||
|
||||
# process management
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user