Bug 1304282 - Disable output buffering from mozharness spawned processes; r=ted

Without this, process output is buffered by default. This means
timestamps that mozharness prefixes to process output aren't
accurate unless the process is spewing enough output to flush the
output buffer.

Output buffering could lead to bad things. For example, a process
could emit output that would cause mozharness's output monitor to
abort the process. However, if that output is caught in limbo in
the output buffer, mozharness may take several seconds or even
minutes to react.

With this change, the mozharness process receives process output
as soon as that process writes to its standard file descriptors.
Once a newline is seen, mozharness will process it immediately.

Note that this only impacts the case where there is no output
timeout, as the existing code for output timeout uses mozprocess
and I'm pretty sure mozharness doesn't buffer output.

MozReview-Commit-ID: HBkYnfEw7Hb

--HG--
extra : rebase_source : e17b44d88f27c16b054a64c3cc2b3415297daf3b
This commit is contained in:
Gregory Szorc 2016-09-20 23:04:37 -07:00
parent 0f27194436
commit d580a24fa9

View File

@ -1368,7 +1368,8 @@ class ScriptMixin(PlatformMixin):
returncode = int(p.proc.returncode)
else:
p = subprocess.Popen(command, shell=shell, stdout=subprocess.PIPE,
cwd=cwd, stderr=subprocess.STDOUT, env=env)
cwd=cwd, stderr=subprocess.STDOUT, env=env,
bufsize=0)
loop = True
while loop:
if p.poll() is not None: