Skip to content

Commit

Permalink
Use process.execPath to spawn node subprocess instead of requiring no…
Browse files Browse the repository at this point in the history
…de to be on the system PATH.
  • Loading branch information
anuraaga committed Apr 20, 2020
1 parent d2f813f commit cb2c24b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-dev-utils/openBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function getBrowserEnv() {

function executeNodeScript(scriptPath, url) {
const extraArgs = process.argv.slice(2);
const child = spawn('node', [scriptPath, ...extraArgs, url], {
const child = spawn(process.execPath, [scriptPath, ...extraArgs, url], {
stdio: 'inherit',
});
child.on('close', code => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/bin/react-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];

if (['build', 'eject', 'start', 'test'].includes(script)) {
const result = spawn.sync(
'node',
process.execPath,
nodeArgs
.concat(require.resolve('../scripts/' + script))
.concat(args.slice(scriptIndex + 1)),
Expand Down

0 comments on commit cb2c24b

Please sign in to comment.