From 268d1a9aec0143fc5efb256a6aae87c7121a71f7 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Mon, 9 Oct 2017 12:33:48 +0100 Subject: [PATCH] Hide stderr in case -dumpfullversion is not available --- pyop2/compilation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyop2/compilation.py b/pyop2/compilation.py index 33a78a346..5aa31b718 100644 --- a/pyop2/compilation.py +++ b/pyop2/compilation.py @@ -82,11 +82,13 @@ def sniff_compiler_version(cc): if compiler in ["gcc", "icc"]: try: # gcc-7 series only spits out patch level on dumpfullversion. - ver = subprocess.check_output([cc, "-dumpfullversion"]).decode("utf-8") + ver = subprocess.check_output([cc, "-dumpfullversion"], + stderr=subprocess.DEVNULL).decode("utf-8") ver = version.StrictVersion(ver.strip()) except subprocess.CalledProcessError: try: - ver = subprocess.check_output([cc, "-dumpversion"]).decode("utf-8") + ver = subprocess.check_output([cc, "-dumpversion"], + stderr=subprocess.DEVNULL).decode("utf-8") ver = version.StrictVersion(ver.strip()) except (subprocess.CalledProcessError, UnicodeDecodeError): pass