OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 # Runs a subprocess (command and args taken from argv), and collates |
| 7 # its output to stdout such that the subprocess's stdout is printed |
| 8 # followed by its stderr. This matches the collation in |
| 9 # native_client/run.py so that PNaCl and native output can be compared |
| 10 # accurately. |
| 11 |
| 12 import subprocess |
| 13 import sys |
| 14 |
| 15 def main(argv): |
| 16 p = subprocess.Popen(argv[1:], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 17 (stdout_contents, stderr_contents) = p.communicate() |
| 18 sys.stdout.write((stdout_contents or '') + (stderr_contents or '')) |
| 19 return p.returncode |
| 20 |
| 21 if __name__ == '__main__': |
| 22 sys.exit(main(sys.argv)) |
OLD | NEW |