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

target: Return a bool in Target.check_responsive()

Since bool is a subclass of int, turning 0 into False and 1 into True should not
break any user code.
This commit is contained in:
Douglas RAILLARD 2019-12-05 15:51:38 +00:00 committed by Marc Bonnici
parent cf26dee308
commit 2bf4d8a433

View File

@ -546,11 +546,11 @@ class Target(object):
def check_responsive(self, explode=True): def check_responsive(self, explode=True):
try: try:
self.conn.execute('ls /', timeout=5) self.conn.execute('ls /', timeout=5)
return 1 return True
except (DevlibTransientError, subprocess.CalledProcessError): except (DevlibTransientError, subprocess.CalledProcessError):
if explode: if explode:
raise TargetNotRespondingError('Target {} is not responding'.format(self.conn.name)) raise TargetNotRespondingError('Target {} is not responding'.format(self.conn.name))
return 0 return False
# process management # process management