[lld] r349204 - [test] Capture stderr from 'tar --version' call as well

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 14 14:38:01 PST 2018


Author: mgorny
Date: Fri Dec 14 14:38:01 2018
New Revision: 349204

URL: http://llvm.org/viewvc/llvm-project?rev=349204&view=rev
Log:
[test] Capture stderr from 'tar --version' call as well

Capture the stderr from 'tar --version' call as otherwise error messages
spill onto user's terminal unnecessarily (e.g. on NetBSD where tar does
not support long options).  While at it, refactor the code to use
communicate() instead of reinventing the wheel.

Differential Revision: https://reviews.llvm.org/D55443

Modified:
    lld/trunk/test/lit.cfg.py

Modified: lld/trunk/test/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg.py?rev=349204&r1=349203&r2=349204&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg.py (original)
+++ lld/trunk/test/lit.cfg.py Fri Dec 14 14:38:01 2018
@@ -94,7 +94,10 @@ if config.have_dia_sdk:
 tar_executable = lit.util.which('tar', config.environment['PATH'])
 if tar_executable:
     tar_version = subprocess.Popen(
-        [tar_executable, '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
-    if 'GNU tar' in tar_version.stdout.read().decode():
+        [tar_executable, '--version'],
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        env={'LANG': 'C'})
+    sout, _ = tar_version.communicate()
+    if 'GNU tar' in sout.decode():
         config.available_features.add('gnutar')
-    tar_version.wait()




More information about the llvm-commits mailing list