adb: fix device module for non-shell_v2 usage.
The device.py module was incorrectly querying the return code when the shell_v2 return code isn't available. This CL fixes it by specifying the return code probe as an argument list rather than a single string argument. This means that before the device was executing something like this: /system/bin/sh getprop '; echo $?' which didn't do what we wanted. Now it does something like this: /system/bin/sh getprop ; echo $? Bug: http://b/25470461 Change-Id: I5e20da31ec7ecc782c6146d8b38d752d52082860
This commit is contained in:
@@ -239,7 +239,7 @@ class AndroidDevice(object):
|
|||||||
#
|
#
|
||||||
# The delimiter is needed because `printf 1; echo $?` would print
|
# The delimiter is needed because `printf 1; echo $?` would print
|
||||||
# "10", and we wouldn't be able to distinguish the exit code.
|
# "10", and we wouldn't be able to distinguish the exit code.
|
||||||
_RETURN_CODE_PROBE_STRING = 'echo "{0}$?"'.format(_RETURN_CODE_DELIMITER)
|
_RETURN_CODE_PROBE = [';', 'echo', '{0}$?'.format(_RETURN_CODE_DELIMITER)]
|
||||||
|
|
||||||
# Maximum search distance from the output end to find the delimiter.
|
# Maximum search distance from the output end to find the delimiter.
|
||||||
# adb on Windows returns \r\n even if adbd returns \n.
|
# adb on Windows returns \r\n even if adbd returns \n.
|
||||||
@@ -279,7 +279,7 @@ class AndroidDevice(object):
|
|||||||
def _make_shell_cmd(self, user_cmd):
|
def _make_shell_cmd(self, user_cmd):
|
||||||
command = self.adb_cmd + ['shell'] + user_cmd
|
command = self.adb_cmd + ['shell'] + user_cmd
|
||||||
if self.SHELL_PROTOCOL_FEATURE not in self.features:
|
if self.SHELL_PROTOCOL_FEATURE not in self.features:
|
||||||
command.append('; ' + self._RETURN_CODE_PROBE_STRING)
|
command += self._RETURN_CODE_PROBE
|
||||||
return command
|
return command
|
||||||
|
|
||||||
def _parse_shell_output(self, out):
|
def _parse_shell_output(self, out):
|
||||||
|
|||||||
Reference in New Issue
Block a user