Skip to content

Commit

Permalink
binstubs: do not exec via the shell, but rather execute the programs …
Browse files Browse the repository at this point in the history
…directly (#355)

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
  • Loading branch information
fsateler authored and gauravtiwari committed May 10, 2017
1 parent 90ba29b commit 14d2691
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/install/bin/webpack-dev-server.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions lib/install/bin/webpack.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 14d2691

Please sign in to comment.