This commit is contained in:
Thomas Nagy 2012-02-06 02:13:25 +01:00
parent 2263d60b8d
commit 4404d9062c
2 changed files with 10 additions and 11 deletions

View File

@ -1014,11 +1014,11 @@ def get_cc_version(conf, cc, gcc=False, icc=False):
p = Utils.subprocess.Popen(cmd, stdin=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
p.stdin.write('\n'.encode())
out = p.communicate()[0]
except:
except Exception:
conf.fatal('Could not determine the compiler version %r' % cmd)
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding)
out = out.decode(sys.stdout.encoding or 'iso8859-1')
if gcc:
if out.find('__INTEL_COMPILER') >= 0:
@ -1031,7 +1031,7 @@ def get_cc_version(conf, cc, gcc=False, icc=False):
k = {}
if icc or gcc:
out = out.split('\n')
out = out.splitlines()
for line in out:
lst = shlex.split(line)
if len(lst)>2:

View File

@ -336,15 +336,14 @@ def getoutput(conf, cmd, stdin=False):
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
if stdin:
p.stdin.write('\n'.encode())
stdout, stderr = p.communicate()
except:
out, err = p.communicate()
except Exception:
conf.fatal('could not determine the compiler version %r' % cmd)
else:
if not isinstance(stdout, str):
stdout = stdout.decode(sys.stdout.encoding)
if not isinstance(stderr, str):
stderr = stderr.decode(sys.stdout.encoding)
return stdout, stderr
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding or 'iso8859-1')
if not isinstance(err, str):
err = err.decode(sys.stdout.encoding or 'iso8859-1')
return (out, err)
# ------------------------------------------------------------------------