Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Quote paths passed to child_process.exec.
Browse files Browse the repository at this point in the history
This is necessary on Windows; otherwise you get

    2> 'c:\PROGRAM' is not recognized as an internal or external command,
    2> operable program or batch file.

since Node/npm are in "C:\Program Files (x86)\nodejs", which has spaces in it.
  • Loading branch information
domenic authored and isaacs committed Jun 18, 2012
1 parent 59dda0b commit 391b8a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/run.js
Expand Up @@ -72,8 +72,8 @@ function exec (cmd, shouldFail, cb) {
// special: replace 'node' with the current execPath, // special: replace 'node' with the current execPath,
// and 'npm' with the thing we installed. // and 'npm' with the thing we installed.
var cmdShow = cmd var cmdShow = cmd
cmd = cmd.replace(/^npm /, path.resolve(npmPath, "npm") + " ") cmd = cmd.replace(/^npm /, "\"" + path.resolve(npmPath, "npm") + "\" ")
cmd = cmd.replace(/^node /, process.execPath + " ") cmd = cmd.replace(/^node /, "\"" + process.execPath + "\" ")


child_process.exec(cmd, {env: env}, function (er, stdout, stderr) { child_process.exec(cmd, {env: env}, function (er, stdout, stderr) {
if (stdout) { if (stdout) {
Expand Down

0 comments on commit 391b8a3

Please sign in to comment.