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

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

Issue 2707113002: [devil] Add an iteration timeout option to cmd_helper.IterCmdStdoutLines. (Closed)
Patch Set: mikecase comments Created 3 years, 10 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/sdk/adb_wrapper.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/logcat_monitor.py
diff --git a/devil/devil/android/logcat_monitor.py b/devil/devil/android/logcat_monitor.py
index c99fda9f0ba2de83f38bdc6e8183f3e7a7f437eb..0aece87dee4f2ea2eb40327e7ee8f60459750883 100644
--- a/devil/devil/android/logcat_monitor.py
+++ b/devil/devil/android/logcat_monitor.py
@@ -23,7 +23,8 @@ logger = logging.getLogger(__name__)
class LogcatMonitor(object):
- _RECORD_THREAD_JOIN_WAIT = 2.0
+ _RECORD_ITER_TIMEOUT = 2.0
+ _RECORD_THREAD_JOIN_WAIT = 5.0
_WAIT_TIME = 0.2
_THREADTIME_RE_FORMAT = (
r'(?P<date>\S*) +(?P<time>\S*) +(?P<proc_id>%s) +(?P<thread_id>%s) +'
@@ -164,10 +165,16 @@ class LogcatMonitor(object):
# Write the log with line buffering so the consumer sees each individual
# line.
for data in self._adb.Logcat(filter_specs=self._filter_specs,
- logcat_format='threadtime'):
+ logcat_format='threadtime',
+ iter_timeout=self._RECORD_ITER_TIMEOUT):
+ if self._stop_recording_event.isSet():
+ return
+
+ if data is None:
+ # Logcat can yield None if the iter_timeout is hit.
+ continue
+
with self._record_file_lock:
- if self._stop_recording_event.isSet():
- return
if self._record_file and not self._record_file.closed:
self._record_file.write(data + '\n')
« no previous file with comments | « no previous file | devil/devil/android/sdk/adb_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698