Skip to content
Permalink
Browse files

Write subprocess stdout/stderr logs to raw stdout buffer when using P…

…ython3
  • Loading branch information
marmeladema committed Dec 9, 2019
1 parent 63d5d8a commit 17233f2dd298a1ed6933e45870c3cb6878456cef
Showing with 11 additions and 2 deletions.
  1. +11 −2 python/mach_bootstrap.py
@@ -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)

0 comments on commit 17233f2

Please sign in to comment.
You can’t perform that action at this time.