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

Unified Diff: build/compiler_version.py

Issue 10288005: compiler_version: suppress stdout unless command fails (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/compiler_version.py
diff --git a/build/compiler_version.py b/build/compiler_version.py
index 9132261faea1bee8db7c5f5ac6b2af3d22bec029..f1e5c4722c0469825acc561fc9e636fbb54e299c 100755
--- a/build/compiler_version.py
+++ b/build/compiler_version.py
@@ -18,11 +18,17 @@ def GetVersion(compiler):
try:
# Note that compiler could be something tricky like "distcc g++".
compiler = compiler + " -dumpversion"
- pipe = subprocess.Popen(compiler, stdout=subprocess.PIPE, shell=True)
- gcc_output = pipe.communicate()[0]
+ pipe = subprocess.Popen(compiler, shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ gcc_output, gcc_error = pipe.communicate()
+ if pipe.returncode:
+ raise subprocess.CalledProcessError(pipe.returncode, compiler)
+
result = re.match(r"(\d+)\.(\d+)", gcc_output)
return result.group(1) + result.group(2)
except Exception, e:
+ if gcc_error:
+ sys.stderr.write(gcc_error)
print >> sys.stderr, "compiler_version.py failed to execute:", compiler
print >> sys.stderr, e
return ""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698