From fbed4e1dcfebd154439de22a0b8461e04266672a Mon Sep 17 00:00:00 2001 From: Michal Gorny Date: Fri, 14 Dec 2018 22:38:01 +0000 Subject: [PATCH] [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 llvm-svn: 349204 --- lld/test/lit.cfg.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py index d4d9ea7..9989a1c 100644 --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -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() -- 2.7.4