fix(bin/linja): decode the results from subprocess.Popen

http://stackoverflow.com/questions/606191/convert-bytes-to-a-python-string

fix #515
This commit is contained in:
Soonho Kong 2015-04-04 13:25:42 -04:00
parent 4ec0e1b07c
commit 8ca3ee4851

View file

@ -516,6 +516,10 @@ def call_ninja(args):
ninja_option += ["-k", args.keep_going]
proc = subprocess.Popen([g_ninja_path] + ninja_option + targets, stdout=proc_out, stderr=proc_err)
(out, err) = proc.communicate()
if out:
out = out.decode('utf-8')
if err:
err = err.decode('utf-8')
if args.flycheck:
if len(args.targets) == 1 and (args.targets[0].endswith(".lean") or args.targets[0].endswith(".hlean")):
process_lean_output(targets[0], out, args, args.targets[0].endswith(".hlean"))
@ -528,7 +532,7 @@ def call_ninja(args):
def call_lean(filename, args):
proc = subprocess.Popen([g_lean_path] + args.lean_options + [filename],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = proc.communicate()[0]
out = proc.communicate()[0].decode('utf-8')
process_lean_output(filename, out, args, filename.endswith(".hlean"))
return proc.returncode
@ -684,13 +688,13 @@ def make_deps(lean_file, dlean_file, olean_file):
with open(dlean_file, "w") as f:
deps = []
proc = subprocess.Popen([g_lean_path, "--deps", lean_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = proc.communicate()[0]
output = proc.communicate()[0].decode('utf-8')
print(escape_dep(olean_file) + ": \\", file=f)
for olean_file in output.strip().splitlines():
if olean_file:
deps.append(normalize_drive_name(os.path.abspath(olean_file)))
deps = list(map(escape_dep, deps))
deps_str = b" " + (b" \\\n ".join(deps))
deps_str = " " + (" \\\n ".join(deps))
print(deps_str, file=f)
def make_deps_all_files(args):