From 171cc25d508a7a661d6372866264a7e991e113db Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Mon, 14 Dec 2015 17:21:47 +0000 Subject: [PATCH] AndroidTarget: fixed use of variables in as_root=True commands. In order to execute as root, the command string gets echo'd into so; previusly, double quotes were used in echo, which caused any veriables in the command string to be expanded _before_ it was echoed. --- 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 7c5d62c..8334d6f 100644 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -287,7 +287,7 @@ def _ping(device): def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=False): # NOQA _check_env() if as_root: - command = 'echo "{}" | su'.format(escape_double_quotes(command)) + command = 'echo \'{}\' | su'.format(escape_single_quotes(command)) device_string = ' -s {}'.format(device) if device else '' full_command = 'adb{} shell "{}"'.format(device_string, escape_double_quotes(command))