fix broken waf --valgrind argument; also make compatible with Python 3

This commit is contained in:
Tom Henderson
2015-11-15 09:15:28 -08:00
parent 7a1e9cfb7f
commit fd7c2917b5

View File

@@ -115,10 +115,13 @@ def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):
raise WafError("Options --command-template and --valgrind are conflicting") raise WafError("Options --command-template and --valgrind are conflicting")
if not env['VALGRIND']: if not env['VALGRIND']:
raise WafError("valgrind is not installed") raise WafError("valgrind is not installed")
argv = [env['VALGRIND'], "--leak-check=full", "--show-reachable=yes", "--error-exitcode=1"] + argv # Use the first program found in the env['VALGRIND'] list
argv = [env['VALGRIND'][0], "--leak-check=full", "--show-reachable=yes", "--error-exitcode=1"] + argv
proc = subprocess.Popen(argv, env=proc_env, cwd=cwd, stderr=subprocess.PIPE) proc = subprocess.Popen(argv, env=proc_env, cwd=cwd, stderr=subprocess.PIPE)
stderrdata = proc.communicate()[1]
stderrdata = stderrdata.decode('utf-8')
error = False error = False
for line in proc.stderr: for line in stderrdata:
sys.stderr.write(line) sys.stderr.write(line)
if "== LEAK SUMMARY" in line: if "== LEAK SUMMARY" in line:
error = True error = True