From ea3bcef2f2e569136dfbb22b6b7a7040043383ab Mon Sep 17 00:00:00 2001 From: Felipe Sateler Date: Tue, 9 May 2017 20:17:38 -0300 Subject: [PATCH] binstubs: do not exec via the shell, but rather execute the programs directly Windows cmd does not support the ENVVAR=VALUE syntax prepended to a command, so the binstubs did not work there. To avoid that, use the exec form that does not go via the shell, and instead executes the program directly. Fixes: #245 --- lib/install/bin/webpack-dev-server.tt | 6 ++++-- lib/install/bin/webpack.tt | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/install/bin/webpack-dev-server.tt b/lib/install/bin/webpack-dev-server.tt index 368cbb054..94f8eaa57 100644 --- a/lib/install/bin/webpack-dev-server.tt +++ b/lib/install/bin/webpack-dev-server.tt @@ -27,7 +27,9 @@ rescue Errno::ENOENT, NoMethodError exit! end +newenv = { "NODE_PATH" => NODE_MODULES_PATH } +cmdline = [WEBPACK_BIN, "--progress", "--color", "--config", DEV_SERVER_CONFIG] + ARGV + Dir.chdir(APP_PATH) do - exec "NODE_PATH=#{NODE_MODULES_PATH} #{WEBPACK_BIN} --progress --color " \ - "--config #{DEV_SERVER_CONFIG} #{ARGV.join(" ")}" + exec newenv, *cmdline end diff --git a/lib/install/bin/webpack.tt b/lib/install/bin/webpack.tt index cc302b8af..f67e18030 100644 --- a/lib/install/bin/webpack.tt +++ b/lib/install/bin/webpack.tt @@ -27,7 +27,9 @@ end WEBPACK_BIN = "#{NODE_MODULES_PATH}/.bin/webpack" WEBPACK_CONFIG = "#{WEBPACK_CONFIG_PATH}/#{NODE_ENV}.js" +newenv = { "NODE_PATH" => NODE_MODULES_PATH } +cmdline = [WEBPACK_BIN, "--config", WEBPACK_CONFIG] + ARGV + Dir.chdir(APP_PATH) do - exec "NODE_PATH=#{NODE_MODULES_PATH} #{WEBPACK_BIN} --config #{WEBPACK_CONFIG}" \ - " #{ARGV.join(" ")}" + exec newenv, *cmdline end