mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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:
|
||||
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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue