mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +00:00
utils/android: Log error in _ping()
Log any error happening in adb command ran by _ping() so it can be diagnosed. Also fix possible deadlock by not using subprocess.PIPE along subprocess.call(), as the documentation recommends against it.
This commit is contained in:
parent
94f1812ab2
commit
b8292b1f2b
@ -571,11 +571,13 @@ def _ping(device, adb_server=None, adb_port=None):
|
||||
adb_cmd = get_adb_command(device, 'shell', adb_server, adb_port)
|
||||
command = "{} {}".format(adb_cmd, quote('ls /data/local/tmp > /dev/null'))
|
||||
logger.debug(command)
|
||||
result = subprocess.call(command, stderr=subprocess.PIPE, shell=True)
|
||||
if not result: # pylint: disable=simplifiable-if-statement
|
||||
return True
|
||||
else:
|
||||
try:
|
||||
subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.debug(f'ADB ping failed: {e.stdout}')
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
# pylint: disable=too-many-locals
|
||||
|
Loading…
x
Reference in New Issue
Block a user