Index: tools/valgrind/common.py |
=================================================================== |
--- tools/valgrind/common.py (revision 202516) |
+++ tools/valgrind/common.py (working copy) |
@@ -35,6 +35,9 @@ |
""" |
logging.info("running %s, timeout %d sec" % (" ".join(proc), timeout)) |
+ sys.stdout.flush() |
+ sys.stderr.flush() |
+ |
# Manually read and print out stdout and stderr. |
# By default, the subprocess is supposed to inherit these from its parent, |
# however when run under buildbot, it seems unable to read data from a |
@@ -43,25 +46,22 @@ |
# necessary. |
# TODO(erikkay): should we buffer stderr and stdout separately? |
p = subprocess.Popen(proc, universal_newlines=True, |
- bufsize=1, # line buffered |
+ bufsize=0, # unbuffered |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
logging.info("started subprocess") |
- # How long to wait (in seconds) before printing progress log messages. |
- progress_delay = 300 |
- progress_delay_time = time.time() + progress_delay |
did_timeout = False |
if timeout > 0: |
wait_until = time.time() + timeout |
while p.poll() is None and not did_timeout: |
- for line in p.stdout: |
+ line = p.stdout.readline() |
+ while line and not did_timeout: |
Nico
2013/07/15 17:16:35
Since this makes a difference and is very non-obvi
Timur Iskhodzhanov
2013/07/15 18:18:43
That was done in r202841 when I actually became su
|
sys.stdout.write(line) |
sys.stdout.flush() |
+ line = p.stdout.readline() |
if timeout > 0: |
did_timeout = time.time() > wait_until |
- if did_timeout: |
- break |
if did_timeout: |
logging.info("process timed out") |
@@ -85,7 +85,7 @@ |
sys.stdout.write(line) |
if not IsMac(): # stdout flush fails on Mac |
logging.info("flushing stdout") |
- p.stdout.flush() |
+ sys.stdout.flush() |
Reid Kleckner
2013/05/28 13:00:27
Aha. :) Is that it?
Reid Kleckner
2013/05/28 13:01:34
Er, no, it shouldn't be.
Timur Iskhodzhanov
2013/05/28 13:01:57
Nope, I don't think so - the hangs happen when pyt
|
logging.info("collecting result code") |
result = p.poll() |