Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3294)

Unified Diff: build/android/gyp/util/build_utils.py

Issue 58563004: Don't swallow "aapt crunch" build errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/process_resources.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 897b6fc94917ff899a46976efb08fb4799dab203..a58fe4a715e552a4a70b0c57a4aee013489f1b5d 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -83,16 +83,20 @@ def ReadJson(path):
# 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):
+def CheckCallDie(args, suppress_output=False, cwd=None, fail_if_stderr=False):
if not cwd:
cwd = os.getcwd()
child = subprocess.Popen(args,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd)
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
- stdout, _ = child.communicate()
+ stdout, stderr = child.communicate()
- if child.returncode:
+ returncode = child.returncode
+ if fail_if_stderr and stderr and returncode == 0:
+ returncode = 1
+
+ if returncode:
stacktrace = traceback.extract_stack()
print >> sys.stderr, ''.join(traceback.format_list(stacktrace))
# A user should be able to simply copy and paste the command that failed
@@ -104,14 +108,19 @@ def CheckCallDie(args, suppress_output=False, cwd=None):
if stdout:
print stdout,
+ if stderr:
+ print >> sys.stderr, stderr,
# Directly exit to avoid printing stacktrace.
- sys.exit(child.returncode)
+ sys.exit(returncode)
else:
- if stdout and not suppress_output:
- print stdout,
- return stdout
+ if not suppress_output:
+ if stdout:
+ print stdout,
+ if stderr:
+ print >> sys.stderr, stderr,
+ return stdout + stderr
cjhopman 2013/11/05 01:10:45 This might screw up the log quietening in ant.py.
newt (away) 2013/11/05 15:28:41 Yes, we might need to readjust, though I think the
def GetModifiedTime(path):
« no previous file with comments | « build/android/gyp/process_resources.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698