Index: build/android/gyp/util/build_utils.py |
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py |
index a58fe4a715e552a4a70b0c57a4aee013489f1b5d..1214bbae6566de16de54cc65c88a83f53c4e6d3d 100644 |
--- a/build/android/gyp/util/build_utils.py |
+++ b/build/android/gyp/util/build_utils.py |
@@ -78,12 +78,7 @@ def ReadJson(path): |
return json.load(jsonfile) |
-# This can be used in most cases like subprocess.check_call. The output, |
-# particularly when the command fails, better highlights the command's failure. |
-# This call will directly exit on a failure in the subprocess so that no python |
-# stacktrace is printed after the output of the failed command (and will |
-# instead print a python stack trace before the output of the failed command) |
-def CheckCallDie(args, suppress_output=False, cwd=None, fail_if_stderr=False): |
+def CheckCall(args, suppress_output=False, cwd=None, fail_if_stderr=False): |
if not cwd: |
cwd = os.getcwd() |
@@ -111,16 +106,30 @@ def CheckCallDie(args, suppress_output=False, cwd=None, fail_if_stderr=False): |
if stderr: |
print >> sys.stderr, stderr, |
- # Directly exit to avoid printing stacktrace. |
- sys.exit(returncode) |
- |
else: |
if not suppress_output: |
if stdout: |
print stdout, |
if stderr: |
print >> sys.stderr, stderr, |
- return stdout + stderr |
+ |
+ return (returncode, stdout + stderr) |
+ |
+ |
+# This can be used in most cases like subprocess.check_call. The output, |
+# particularly when the command fails, better highlights the command's failure. |
+# This call will directly exit on a failure in the subprocess so that no python |
+# stacktrace is printed after the output of the failed command (and will |
+# instead print a python stack trace before the output of the failed command) |
+def CheckCallDie(args, suppress_output=False, cwd=None, fail_if_stderr=False): |
+ returncode, output = CheckCall(args, suppress_output=suppress_output, cwd=cwd, |
+ fail_if_stderr=fail_if_stderr) |
+ |
+ if returncode: |
+ # Directly exit to avoid printing stacktrace. |
+ sys.exit(returncode) |
+ |
+ return output |
def GetModifiedTime(path): |