Skip to content
Snippets Groups Projects
Commit 4d2e3696 authored by Eric Müller's avatar Eric Müller :mountain_bicyclist: Committed by Jakob Kaiser
Browse files

fix: Unblock child's stdout printing

This sets the subprocess to avoid blocking reads and we now can use
unlimited reads (i.e. larger-than-per-line chunks) and use those.
For subprocesses printing fast this should avoid any buffers to fill up.

Change-Id: If3f67b2aaf7431a4b7abb58e1b64e2a70ff05eb2
parent e66a2e08
No related branches found
No related tags found
No related merge requests found
......@@ -193,14 +193,15 @@ def run(script: str, env: dict, script_args: list = []):
out = subprocess.Popen(
cmd, env=env, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
os.set_blocking(out.stdout.fileno(), False)
while True:
line = out.stdout.readline()
if line:
data = out.stdout.read()
if data:
if args.debug:
sys.stdout.buffer.write(line)
sys.stdout.buffer.write(data)
sys.stdout.flush()
stdout += line
else:
stdout += data
if out.poll() is not None:
break
out.wait()
stdout = str(stdout, encoding="utf-8")
......
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