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 "" |