Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: build/android/pylib/device/adb_wrapper.py

Issue 666943002: Revert of New run shell implementation for DeviceUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/cmd_helper_test.py ('k') | build/android/pylib/device/adb_wrapper_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """This module wraps Android's adb tool. 5 """This module wraps Android's adb tool.
6 6
7 This is a thin wrapper around the adb interface. Any additional complexity 7 This is a thin wrapper around the adb interface. Any additional complexity
8 should be delegated to a higher level (ex. DeviceUtils). 8 should be delegated to a higher level (ex. DeviceUtils).
9 """ 9 """
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 |expect_rc|. 169 |expect_rc|.
170 """ 170 """
171 if expect_rc is None: 171 if expect_rc is None:
172 actual_command = command 172 actual_command = command
173 else: 173 else:
174 actual_command = '%s; echo $?;' % command 174 actual_command = '%s; echo $?;' % command
175 output = self._DeviceAdbCmd( 175 output = self._DeviceAdbCmd(
176 ['shell', actual_command], timeout, retries, check_error=False) 176 ['shell', actual_command], timeout, retries, check_error=False)
177 if expect_rc is not None: 177 if expect_rc is not None:
178 output_end = output.rstrip().rfind('\n') + 1 178 output_end = output.rstrip().rfind('\n') + 1
179 rc = int(output[output_end:].strip()) 179 rc = output[output_end:].strip()
180 output = output[:output_end] 180 output = output[:output_end]
181 if rc != expect_rc: 181 if int(rc) != expect_rc:
182 raise device_errors.AdbShellCommandFailedError( 182 raise device_errors.AdbCommandFailedError(
183 command, rc, output, self._device_serial) 183 ['shell', command],
184 'shell command exited with code: %s' % rc,
185 self._device_serial)
184 return output 186 return output
185 187
186 def Logcat(self, filter_spec=None, timeout=_DEFAULT_TIMEOUT, 188 def Logcat(self, filter_spec=None, timeout=_DEFAULT_TIMEOUT,
187 retries=_DEFAULT_RETRIES): 189 retries=_DEFAULT_RETRIES):
188 """Get the logcat output. 190 """Get the logcat output.
189 191
190 Args: 192 Args:
191 filter_spec: (optional) Spec to filter the logcat. 193 filter_spec: (optional) Spec to filter the logcat.
192 timeout: (optional) Timeout per try in seconds. 194 timeout: (optional) Timeout per try in seconds.
193 retries: (optional) Number of retries to attempt. 195 retries: (optional) Number of retries to attempt.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 """Restarts the adbd daemon with root permissions, if possible. 378 """Restarts the adbd daemon with root permissions, if possible.
377 379
378 Args: 380 Args:
379 timeout: (optional) Timeout per try in seconds. 381 timeout: (optional) Timeout per try in seconds.
380 retries: (optional) Number of retries to attempt. 382 retries: (optional) Number of retries to attempt.
381 """ 383 """
382 output = self._DeviceAdbCmd(['root'], timeout, retries) 384 output = self._DeviceAdbCmd(['root'], timeout, retries)
383 if 'cannot' in output: 385 if 'cannot' in output:
384 raise device_errors.AdbCommandFailedError(['root'], output) 386 raise device_errors.AdbCommandFailedError(['root'], output)
385 387
OLDNEW
« no previous file with comments | « build/android/pylib/cmd_helper_test.py ('k') | build/android/pylib/device/adb_wrapper_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698