Index: collate.py |
diff --git a/collate.py b/collate.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..d242a8c1852864e9dd8edf0b4332638209f154d4 |
--- /dev/null |
+++ b/collate.py |
@@ -0,0 +1,22 @@ |
+#!/usr/bin/python |
+# Copyright (c) 2013 The Native Client Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Runs a subprocess (command and args taken from argv), and collates |
+# its output to stdout such that the subprocess's stdout is printed |
+# followed by its stderr. This matches the collation in |
+# native_client/run.py so that PNaCl and native output can be compared |
+# accurately. |
+ |
+import subprocess |
+import sys |
+ |
+def main(argv): |
+ p = subprocess.Popen(argv[1:], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
+ (stdout_contents, stderr_contents) = p.communicate() |
+ sys.stdout.write((stdout_contents or '') + (stderr_contents or '')) |
+ return p.returncode |
+ |
+if __name__ == '__main__': |
+ sys.exit(main(sys.argv)) |