fix broken waf --valgrind argument; also make compatible with Python 3
authorTom Henderson <tomh@tomh.org>
Sun, 15 Nov 2015 09:15:28 -0800
changeset 11765 308891f0a6da
parent 11764 cfec4dc399f5
child 11766 61acba4a788a
fix broken waf --valgrind argument; also make compatible with Python 3
wutils.py
--- a/wutils.py	Sat Nov 14 23:23:35 2015 +0100
+++ b/wutils.py	Sun Nov 15 09:15:28 2015 -0800
@@ -115,10 +115,13 @@
             raise WafError("Options --command-template and --valgrind are conflicting")
         if not env['VALGRIND']:
             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)
+        stderrdata = proc.communicate()[1]
+        stderrdata = stderrdata.decode('utf-8')
         error = False
-        for line in proc.stderr:
+        for line in stderrdata:
             sys.stderr.write(line)
             if "== LEAK SUMMARY" in line:
                 error = True