Index: testing/tools/common.py |
diff --git a/testing/tools/common.py b/testing/tools/common.py |
index 14745a8a3e62348254e111d9999a35eec3a0ceaf..d45404b4d4dd2a3f7d7094ab903002efa0d411e0 100755 |
--- a/testing/tools/common.py |
+++ b/testing/tools/common.py |
@@ -4,6 +4,7 @@ |
# found in the LICENSE file. |
import os |
+import subprocess |
import sys |
def os_name(): |
@@ -16,6 +17,17 @@ def os_name(): |
raise Exception('Confused, can not determine OS, aborting.') |
+def RunCommand(cmd, redirect_output=False): |
+ try: |
+ if redirect_output: |
+ sys.stdout.write(subprocess.check_output(cmd, stderr=subprocess.STDOUT)) |
+ else: |
+ subprocess.check_call(cmd) |
+ return None |
+ except subprocess.CalledProcessError as e: |
+ return e |
+ |
+ |
class DirectoryFinder: |
'''A class for finding directories and paths under either a standalone |
checkout or a chromium checkout of PDFium.''' |