diff options
author | David Pursell <dpursell@google.com> | 2015-11-05 11:26:42 -0800 |
---|---|---|
committer | David Pursell <dpursell@google.com> | 2015-11-05 11:26:42 -0800 |
commit | 51f2cc2185f5285e587197d3bee9da60201c16e5 (patch) | |
tree | 4033bfe9e371247db87ea78e2e2d30fa1545856f /python-packages | |
parent | 1ccb0e835d98264aa78e9b0cbe94f2f523112d5b (diff) | |
download | android_development-51f2cc2185f5285e587197d3bee9da60201c16e5.tar.gz android_development-51f2cc2185f5285e587197d3bee9da60201c16e5.tar.bz2 android_development-51f2cc2185f5285e587197d3bee9da60201c16e5.zip |
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
Diffstat (limited to 'python-packages')
-rw-r--r-- | python-packages/adb/device.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python-packages/adb/device.py b/python-packages/adb/device.py index 9ac7a112a..436593bb7 100644 --- a/python-packages/adb/device.py +++ b/python-packages/adb/device.py @@ -239,7 +239,7 @@ class AndroidDevice(object): # # The delimiter is needed because `printf 1; echo $?` would print # "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. # 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): command = self.adb_cmd + ['shell'] + user_cmd if self.SHELL_PROTOCOL_FEATURE not in self.features: - command.append('; ' + self._RETURN_CODE_PROBE_STRING) + command += self._RETURN_CODE_PROBE return command def _parse_shell_output(self, out): |