Commit 2766bbd1 authored by Konstantin Tarkus's avatar Konstantin Tarkus Committed by Joe Haddad
Browse files

Fix the order of arguments in spawned child proc (#2913)

* Fix the order of arguments in spawned child proc

* Update react-scripts.js

* Remove a comma

* Update react-scripts.js
parent e12d053c
Showing with 9 additions and 3 deletions
+9 -3
...@@ -11,8 +11,12 @@ ...@@ -11,8 +11,12 @@
'use strict'; 'use strict';
const spawn = require('react-dev-utils/crossSpawn'); const spawn = require('react-dev-utils/crossSpawn');
const script = process.argv[2]; const args = process.argv.slice(2);
const args = process.argv.slice(3);
const scriptIndex = args.findIndex(x =>
x === 'build' || x === 'eject' || x === 'start' || x === 'test');
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
switch (script) { switch (script) {
case 'build': case 'build':
...@@ -21,7 +25,9 @@ switch (script) { ...@@ -21,7 +25,9 @@ switch (script) {
case 'test': { case 'test': {
const result = spawn.sync( const result = spawn.sync(
'node', 'node',
[require.resolve(`../scripts/${script}`)].concat(args), nodeArgs
.concat(require.resolve('../scripts/' + script))
.concat(args.slice(scriptIndex + 1)),
{ stdio: 'inherit' } { stdio: 'inherit' }
); );
if (result.signal) { if (result.signal) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment