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

Unified Diff: devil/devil/android/device_utils.py

Issue 3016623002: devil: Fix exit code handling when greping through lsof.
Patch Set: Created 3 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/device_utils.py
diff --git a/devil/devil/android/device_utils.py b/devil/devil/android/device_utils.py
index 322b9d114a63b592132836cd02f0d9f18ff19e49..0d5fa9f2e53f1285119ddf9af23b5ea4d2e95fb6 100644
--- a/devil/devil/android/device_utils.py
+++ b/devil/devil/android/device_utils.py
@@ -1055,11 +1055,11 @@ class DeviceUtils(object):
else:
return output
- def _RunPipedShellCommand(self, script, **kwargs):
+ def _RunPipedShellCommand(self, script, check_return=True, **kwargs):
PIPESTATUS_LEADER = 'PIPESTATUS: '
script += '; echo "%s${PIPESTATUS[@]}"' % PIPESTATUS_LEADER
- kwargs.update(shell=True, check_return=True)
+ kwargs.update(shell=True)
output = self.RunShellCommand(script, **kwargs)
pipestatus_line = output[-1]
@@ -1072,7 +1072,7 @@ class DeviceUtils(object):
output = output[:-1]
statuses = [
int(s) for s in pipestatus_line[len(PIPESTATUS_LEADER):].split()]
- if any(statuses):
+ if check_return and any(statuses):
raise device_errors.AdbShellCommandFailedError(
script, output, status=statuses,
device_serial=self.serial)
@@ -1370,8 +1370,8 @@ class DeviceUtils(object):
logging.error(
'Hit EBUSY while attempting to make missing directories.')
logging.error('lsof output:')
- for l in self._RunPipedShellCommand(
- 'lsof | grep %s' % cmd_helper.SingleQuote(m.group(1))):
+ cmd = 'lsof | grep %s' % cmd_helper.SingleQuote(m.group(1))
+ for l in self._RunPipedShellCommand(cmd, check_return=False):
logging.error(' %s', l)
raise
self._PushFilesImpl(host_device_tuples, all_changed_files)
« no previous file with comments | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698