From 8b201332298b8aad4e976b321bfb682e8f5c4392 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Sun, 21 Jun 2020 02:58:58 +0900 Subject: [PATCH] Use process.execPath to spawn node subprocess (#8694) --- packages/react-dev-utils/openBrowser.js | 2 +- packages/react-scripts/bin/react-scripts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index a84326038c7..babdc9b854e 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -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 => { diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index 7e6e290251a..09604f6a03f 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -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)),