mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 03:12:34 +01:00
utils/android: 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.
This commit is contained in:
@@ -230,7 +230,7 @@ am_start_error = re.compile(r"Error: Activity class {[\w|.|/]*} does not exist")
|
|||||||
def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=False): # NOQA
|
def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=False): # NOQA
|
||||||
_check_env()
|
_check_env()
|
||||||
if as_root:
|
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 ''
|
device_string = '-s {}'.format(device) if device else ''
|
||||||
full_command = 'adb {} shell "{}"'.format(device_string, escape_double_quotes(command))
|
full_command = 'adb {} shell "{}"'.format(device_string, escape_double_quotes(command))
|
||||||
logger.debug(full_command)
|
logger.debug(full_command)
|
||||||
|
Reference in New Issue
Block a user