Commits

Anonymous committed 731e65a

cleanup

Comments (0)

Files changed (2)

waflib/Tools/c_config.py

 		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:
 
 	k = {}
 	if icc or gcc:
-		out = out.split('\n')
+		out = out.splitlines()
 		for line in out:
 			lst = shlex.split(line)
 			if len(lst)>2:

waflib/Tools/fc_config.py

 		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)
 
 # ------------------------------------------------------------------------