mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Write subprocess stdout/stderr logs to raw stdout buffer when using Python3
This commit is contained in:
parent
63d5d8a4b6
commit
17233f2dd2
1 changed files with 11 additions and 2 deletions
|
@ -104,13 +104,22 @@ def _process_exec(args):
|
||||||
if process.returncode:
|
if process.returncode:
|
||||||
print('"%s" failed with error code %d:' % ('" "'.join(args), 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:')
|
print('Output:')
|
||||||
out.seek(0)
|
out.seek(0)
|
||||||
shutil.copyfileobj(out, sys.stdout)
|
stdout.flush()
|
||||||
|
shutil.copyfileobj(out, stdout)
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
print('Error:')
|
print('Error:')
|
||||||
err.seek(0)
|
err.seek(0)
|
||||||
shutil.copyfileobj(err, sys.stdout)
|
stdout.flush()
|
||||||
|
shutil.copyfileobj(err, stdout)
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue