Redirect STDERR to STDOUT for compiler version

This is necessary for the NAG Fortran compiler, which prints its version message to STDERR instead of STDOUT. This message was previously being ignored, preventing spack from finding the compiler's version or automatically adding it to the compilers.yaml configuration file.
This commit is contained in:
Adam J. Stewart 2016-01-20 14:44:43 -06:00
parent 83de658ee4
commit e25150296a

View File

@ -24,6 +24,7 @@
##############################################################################
import os
import re
import subprocess
import itertools
from datetime import datetime
@ -51,7 +52,7 @@ def _verify_executables(*paths):
def get_compiler_version(compiler_path, version_arg, regex='(.*)'):
if not compiler_path in _version_cache:
compiler = Executable(compiler_path)
output = compiler(version_arg, return_output=True, error=os.devnull)
output = compiler(version_arg, return_output=True, error=subprocess.STDOUT)
match = re.search(regex, output)
_version_cache[compiler_path] = match.group(1) if match else 'unknown'