1 | #!/usr/bin/env node
|
2 | var spawn = require('cross-spawn');
|
3 | var script = process.argv[2];
|
4 | var args = process.argv.slice(3);
|
5 |
|
6 | switch (script) {
|
7 | case 'build':
|
8 | case 'eject':
|
9 | case 'start':
|
10 | case 'test':
|
11 | var result = spawn.sync(
|
12 | 'node',
|
13 | [require.resolve('../scripts/' + script)].concat(args),
|
14 | {stdio: 'inherit'}
|
15 | );
|
16 | if (result.signal) {
|
17 | if (result.signal == 'SIGKILL') {
|
18 | console.log(
|
19 | 'The build failed because the process exited too early. ' +
|
20 | 'This probably means the system ran out of memory or someone called ' +
|
21 | '`kill -9` on the process.'
|
22 | );
|
23 | } else if (result.signal == 'SIGTERM') {
|
24 | console.log(
|
25 | 'The build failed because the process exited too early. ' +
|
26 | 'Someone might have called `kill` or `killall`, or the system could ' +
|
27 | 'be shutting down.'
|
28 | );
|
29 | }
|
30 | process.exit(1);
|
31 | }
|
32 | process.exit(result.status);
|
33 | break;
|
34 | default:
|
35 | console.log('Unknown script "' + script + '".');
|
36 | console.log('Perhaps you need to update react-scripts?');
|
37 | break;
|
38 | }
|