From e96450d2260585b877e4774237db553556042549 Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Fri, 6 May 2016 13:14:28 +0100 Subject: [PATCH] adb_shell: Fixed getting return codes They way we were attempting to get return codes before always gave us a return code of the previous echo, therefore always `0`. This commit adds the newline into the last echo. --- wlauto/utils/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlauto/utils/android.py b/wlauto/utils/android.py index 6760fdbb..42a068c2 100644 --- a/wlauto/utils/android.py +++ b/wlauto/utils/android.py @@ -276,7 +276,7 @@ def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=Fals full_command = 'adb {} shell "{}"'.format(device_string, escape_double_quotes(command)) logger.debug(full_command) if check_exit_code: - actual_command = "adb {} shell '({}); echo; echo $?'".format(device_string, escape_single_quotes(command)) + actual_command = "adb {} shell '({}); echo \"\n$?\"'".format(device_string, escape_single_quotes(command)) try: raw_output, error = check_output(actual_command, timeout, shell=True) except CalledProcessErrorWithStderr as e: