1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 05:30:44 +00:00

utils/android: change adb_shell error type

Re-raise CalledProcessError originating inside adb_shell as a
TargetError to be consistent with other errors pertaining to the target.
This commit is contained in:
Sergei Trofimov 2018-03-02 15:58:06 +00:00 committed by Marc Bonnici
parent c706e693ba
commit f39631293e

View File

@ -378,7 +378,11 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
adb_shell_command = '({}); echo \"\n$?\"'.format(command)
actual_command = ['adb'] + device_part + ['shell', adb_shell_command]
logger.debug('adb {} shell {}'.format(' '.join(device_part), command))
raw_output, error = check_output(actual_command, timeout, shell=False)
try:
raw_output, error = check_output(actual_command, timeout, shell=False)
except subprocess.CalledProcessError as e:
raise TargetError(str(e))
if raw_output:
try:
output, exit_code, _ = raw_output.replace('\r\n', '\n').replace('\r', '\n').rsplit('\n', 2)