From c5d8159ec467cef821b37114a1d6817bff01627b Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <cwillisf@media.mit.edu> Date: Wed, 7 Nov 2018 11:02:02 -0800 Subject: [PATCH] Fix local compile on Windows We call the local compiler with `subprocess.Popen`, passing `google-closure-compiler` as the command to run. On Windows, the actual command is `google-closure-compiler.cmd` -- the extension is automatically added by the shell. Unfortunately `subprocess.Popen` by default bypasses the shell, leading to an error. Setting `shell=True` makes `Popen` use the Windows shell (`cmd`) and correctky find `google-closure-compiler.cmd`. --- build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index c153ae23..c5682fe1 100755 --- a/build.py +++ b/build.py @@ -323,7 +323,7 @@ class Gen_compressed(threading.Thread): for group in [["google-closure-compiler"], dash_args]: args.extend(filter(lambda item: item, group)) - proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) (stdout, stderr) = proc.communicate() # Build the JSON response. @@ -566,7 +566,7 @@ if __name__ == "__main__": # Sanity check the local compiler test_args = [closure_compiler, os.path.join("build", "test_input.js")] - test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) (stdout, _) = test_proc.communicate() assert stdout == read(os.path.join("build", "test_expect.js"))