Capture stderr when checking for gold version
authorTeresa Johnson <tejohnson@google.com>
Fri, 29 Jul 2016 00:39:56 +0000 (00:39 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 29 Jul 2016 00:39:56 +0000 (00:39 +0000)
On MacOS the ld version is emitted to stderr, resulting in lots of
messages in the ninja check output.

llvm-svn: 277092

llvm/test/tools/gold/X86/v1.12/lit.local.cfg

index 3ac6f01..7f1b613 100644 (file)
@@ -6,9 +6,11 @@ def is_gold_v1_12_linker_available():
   if not config.gold_executable:
     return False
   try:
-    ld_cmd = subprocess.Popen([config.gold_executable, '-v'], stdout = subprocess.PIPE)
-    ld_out = ld_cmd.stdout.read().decode()
-    ld_cmd.wait()
+    ld_cmd = subprocess.Popen([config.gold_executable, '-v'],
+                              stdout = subprocess.PIPE,
+                              stderr = subprocess.PIPE)
+    ld_out, _ = ld_cmd.communicate()
+    ld_out = ld_out.decode()
   except:
     return False