| Index: build/android/pylib/android_commands.py
|
| diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
|
| index f8aecb78e0c2c220510f4c79735c37813d119e91..520d84b190b0fba9c35ae7061bedaee912b9280e 100644
|
| --- a/build/android/pylib/android_commands.py
|
| +++ b/build/android/pylib/android_commands.py
|
| @@ -1258,10 +1258,20 @@ 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_tmpoutfile = tempfile.NamedTemporaryFile(bufsize=0)
|
| self.logcat_process = subprocess.Popen(logcat_command, shell=True,
|
| stdout=self._logcat_tmpoutfile)
|
|
|
| + def GetCurrentRecordedLogcat(self):
|
| + """Return the current content of the logcat being recorded by
|
| + StartRecordingLogcat(). This can be useful to perform timed
|
| + polling/parsing. Do not call after StopRecordingLogcat()."""
|
| + if not self._logcat_tmpoutfile:
|
| + return None
|
| +
|
| + with open(self._logcat_tmpoutfile.name) as f:
|
| + return f.read()
|
| +
|
| def StopRecordingLogcat(self):
|
| """Stops an existing logcat recording subprocess and returns output.
|
|
|
| @@ -1281,6 +1291,7 @@ class AndroidCommands(object):
|
| self._logcat_tmpoutfile.seek(0)
|
| output = self._logcat_tmpoutfile.read()
|
| self._logcat_tmpoutfile.close()
|
| + self._logcat_tmpoutfile = None
|
| return output
|
|
|
| def SearchLogcatRecord(self, record, message, thread_id=None, proc_id=None,
|
|
|