Skip to content

Commit

Permalink
Write subprocess stdout/stderr logs to raw stdout buffer when using P…
Browse files Browse the repository at this point in the history
…ython3
  • Loading branch information
marmeladema committed Dec 10, 2019
1 parent 63d5d8a commit 17233f2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/mach_bootstrap.py
Expand Up @@ -104,13 +104,22 @@ def _process_exec(args):
if process.returncode:
print('"%s" failed with error code %d:' % ('" "'.join(args), process.returncode))

if sys.version_info >= (3, 0):
stdout = sys.stdout.buffer
else:
stdout = sys.stdout

print('Output:')
out.seek(0)
shutil.copyfileobj(out, sys.stdout)
stdout.flush()
shutil.copyfileobj(out, stdout)
stdout.flush()

print('Error:')
err.seek(0)
shutil.copyfileobj(err, sys.stdout)
stdout.flush()
shutil.copyfileobj(err, stdout)
stdout.flush()

sys.exit(1)

Expand Down

0 comments on commit 17233f2

Please sign in to comment.