mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
utils/android: include stderr in adb_shell output
Include stderr output of the executed command in the output returned by adb_shell. This will align the AdbConnection behavior with that of SshConnection and ensure that target.execute() behaves consistently across Android and Linux targets.
This commit is contained in:
parent
d4b0dedc2a
commit
77a6de9453
@ -379,7 +379,7 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
|
|||||||
actual_command = ['adb'] + device_part + ['shell', adb_shell_command]
|
actual_command = ['adb'] + device_part + ['shell', adb_shell_command]
|
||||||
logger.debug('adb {} shell {}'.format(' '.join(device_part), command))
|
logger.debug('adb {} shell {}'.format(' '.join(device_part), command))
|
||||||
try:
|
try:
|
||||||
raw_output, error = check_output(actual_command, timeout, shell=False)
|
raw_output, _ = check_output(actual_command, timeout, shell=False, combined_output=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise TargetError(str(e))
|
raise TargetError(str(e))
|
||||||
|
|
||||||
@ -395,12 +395,12 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
|
|||||||
|
|
||||||
if check_exit_code:
|
if check_exit_code:
|
||||||
exit_code = exit_code.strip()
|
exit_code = exit_code.strip()
|
||||||
re_search = AM_START_ERROR.findall('{}\n{}'.format(output, error))
|
re_search = AM_START_ERROR.findall(output)
|
||||||
if exit_code.isdigit():
|
if exit_code.isdigit():
|
||||||
if int(exit_code):
|
if int(exit_code):
|
||||||
message = ('Got exit code {}\nfrom target command: {}\n'
|
message = ('Got exit code {}\nfrom target command: {}\n'
|
||||||
'STDOUT: {}\nSTDERR: {}')
|
'OUTPUT: {}')
|
||||||
raise TargetError(message.format(exit_code, command, output, error))
|
raise TargetError(message.format(exit_code, command, output))
|
||||||
elif re_search:
|
elif re_search:
|
||||||
message = 'Could not start activity; got the following:\n{}'
|
message = 'Could not start activity; got the following:\n{}'
|
||||||
raise TargetError(message.format(re_search[0]))
|
raise TargetError(message.format(re_search[0]))
|
||||||
@ -411,8 +411,8 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
|
|||||||
else:
|
else:
|
||||||
message = 'adb has returned early; did not get an exit code. '\
|
message = 'adb has returned early; did not get an exit code. '\
|
||||||
'Was kill-server invoked?\nOUTPUT:\n-----\n{}\n'\
|
'Was kill-server invoked?\nOUTPUT:\n-----\n{}\n'\
|
||||||
'-----\nERROR:\n-----\n{}\n-----'
|
'-----'
|
||||||
raise TargetError(message.format(raw_output, error))
|
raise TargetError(message.format(raw_output))
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user