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

Unified Diff: build/android/pylib/android_commands.py

Issue 13861026: [Android] Switch all subprocess.Popen calls to use a temporary file instead of PIPE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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 | build/android/pylib/cmd_helper.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index e565ec89493d6f23449b2b47171377c26e17bb4e..f370efee13d67f7df8d7366a760f6f29662ed1d9 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -204,6 +204,7 @@ class AndroidCommands(object):
self._device = device
self._logcat = None
self.logcat_process = None
+ self._logcat_tmpoutfile = None
self._pushed_files = []
self._device_utc_offset = self.RunShellCommand('date +%z')[0]
self._md5sum_path = ''
@@ -955,8 +956,9 @@ class AndroidCommands(object):
self._adb.SendCommand('logcat -c')
logcat_command = 'adb %s logcat -v threadtime %s' % (self._adb._target_arg,
' '.join(filters))
+ self._logcat_tmpoutfile = tempfile.TemporaryFile(bufsize=0)
self.logcat_process = subprocess.Popen(logcat_command, shell=True,
- stdout=subprocess.PIPE)
+ stdout=self._logcat_tmpoutfile)
def StopRecordingLogcat(self):
"""Stops an existing logcat recording subprocess and returns output.
@@ -972,8 +974,11 @@ class AndroidCommands(object):
# Otherwise the communicate may return incomplete output due to pipe break.
if self.logcat_process.poll() is None:
self.logcat_process.kill()
- (output, _) = self.logcat_process.communicate()
+ self.logcat_process.wait()
self.logcat_process = None
+ self._logcat_tmpoutfile.seek(0)
+ output = self._logcat_tmpoutfile.read()
+ self._logcat_tmpoutfile.close()
return output
def SearchLogcatRecord(self, record, message, thread_id=None, proc_id=None,
« no previous file with comments | « no previous file | build/android/pylib/cmd_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698