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

Unified Diff: mojo/devtools/common/devtoolslib/android_shell.py

Issue 1438123003: Fix `--verbose` handling in android_shell. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Don't mix stdout w/ stderr. Created 5 years, 1 month 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 | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/android_shell.py
diff --git a/mojo/devtools/common/devtoolslib/android_shell.py b/mojo/devtools/common/devtoolslib/android_shell.py
index bd0e68449f3d6379e6b006b876a48f98a277176e..2d8443b42f4df8595bd0ec57905bfd8ac93a7a12 100644
--- a/mojo/devtools/common/devtoolslib/android_shell.py
+++ b/mojo/devtools/common/devtoolslib/android_shell.py
@@ -96,13 +96,14 @@ class AndroidShell(Shell):
"""
def __init__(self, adb_path="adb", target_device=None, logcat_tags=None,
- verbose_pipe=None):
+ verbose=False):
self.adb_path = adb_path
self.target_device = target_device
self.stop_shell_registered = False
self.adb_running_as_root = None
self.additional_logcat_tags = logcat_tags
- self.verbose_pipe = verbose_pipe if verbose_pipe else open(os.devnull, 'w')
+ self.verbose_stdout = sys.stdout if verbose else open(os.devnull, 'w')
+ self.verbose_stderr = sys.stderr if verbose else open(os.devnull, 'w')
qsr 2015/11/12 14:47:37 sys.stderr if verbose else self.verbose_stdout Thi
ppi 2015/11/12 14:50:17 Done.
def _adb_command(self, args):
"""Forms an adb command from the given arguments, prepending the adb path
@@ -208,7 +209,7 @@ class AndroidShell(Shell):
# Wait for adbd to restart.
subprocess.check_call(
self._adb_command(['wait-for-device']),
- stdout=self.verbose_pipe)
+ stdout=self.verbose_stdout, stderr=self.verbose_stderr)
self.adb_running_as_root = True
else:
self.adb_running_as_root = False
@@ -297,7 +298,7 @@ class AndroidShell(Shell):
subprocess.check_call(
self._adb_command(['install', '-r', shell_apk_path, '-i',
_MOJO_SHELL_PACKAGE_NAME]),
- stdout=self.verbose_pipe)
+ stdout=self.verbose_stdout, stderr=self.verbose_stderr)
# Update the stamp on the device.
with tempfile.NamedTemporaryFile() as fp:
@@ -305,7 +306,8 @@ class AndroidShell(Shell):
fp.flush()
subprocess.check_call(self._adb_command(['push', fp.name,
device_sha1_path]),
- stdout=self.verbose_pipe)
+ stdout=self.verbose_stdout,
+ stderr=self.verbose_stderr)
else:
# To ensure predictable state after running install_apk(), we need to stop
# the shell here, as this is what "adb install" implicitly does.
@@ -359,13 +361,15 @@ class AndroidShell(Shell):
temp.write('\n')
temp.close()
subprocess.check_call(self._adb_command(
- ['push', temp.name, device_filename]))
+ ['push', temp.name, device_filename]),
+ stdout=self.verbose_stdout, stderr=self.verbose_stderr)
finally:
os.remove(temp.name)
cmd += ['--es', 'argsFile', device_filename]
- subprocess.check_call(cmd, stdout=self.verbose_pipe)
+ subprocess.check_call(cmd, stdout=self.verbose_stdout,
+ stderr=self.verbose_stderr)
def stop_shell(self):
"""Stops the mojo shell."""
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698