Commit cbf0e5b2 authored by James Darpinian's avatar James Darpinian Committed by Commit Bot

Defeat buffering in asan_symbolize.py

When piping Chrome stdout/stderr through asan_symbolize.py, we want it
to output every line immediately. Python line iterators buffer multiple
lines, so switch to using readline() directly instead.

Change-Id: I90d712c14094929e411b395d0a8d3ae00c0e9d05
Reviewed-on: https://chromium-review.googlesource.com/1114308Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570286}
parent d8b6beee
......@@ -436,7 +436,13 @@ class SymbolizationLoop(object):
def process_logfile(self):
self.frame_no = 0
for line in logfile:
# We use readline directly instead of an iterator ("for line in logfile")
# because the latter introduces extra buffering that is undesirable for
# interactive use.
while 1:
line = logfile.readline()
if not line:
break
processed = self.process_line(line)
print('\n'.join(processed))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment