From f52bf79eb6d716ba0e7e8b385a0bfedbc397090e Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Fri, 11 Dec 2015 17:18:18 +0000 Subject: [PATCH] android: fixing exit code checking This fixes an issue introduced in 64261a65cb8c4c7daeb35186f16d246d3211fa0a The addtional echo means that $? will always have "0" (the exit code for the echo). This removes the extra echo, prepending \n to $? instead --- devlib/utils/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/utils/android.py b/devlib/utils/android.py index 37e2680..7c5d62c 100644 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -293,7 +293,7 @@ def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=Fals escape_double_quotes(command)) logger.debug(full_command) if check_exit_code: - actual_command = "adb{} shell '({}); echo; echo $?'".format(device_string, + actual_command = "adb{} shell '({}); echo \"\n$?\"'".format(device_string, escape_single_quotes(command)) raw_output, error = check_output(actual_command, timeout, shell=True) if raw_output: