Skip to content

Commit b52f311

Browse files
committed
Check status of process
1 parent 9c57ba7 commit b52f311

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

packages/react-scripts/scripts/eject.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,37 @@ function adjustPackages(cwd, packages, append, dev) {
4545
if (!Array.isArray(packages)) {
4646
packages = [packages];
4747
}
48+
let status;
4849
if (fs.existsSync(paths.yarnLockFile)) {
49-
spawnSync('yarnpkg', [append ? 'add' : 'remove', ...packages], {
50-
stdio: 'inherit',
51-
cwd,
52-
});
50+
({ status } = spawnSync(
51+
'yarnpkg',
52+
[append ? 'add' : 'remove', ...packages],
53+
{
54+
stdio: 'pipe',
55+
cwd,
56+
}
57+
));
5358
} else {
54-
spawnSync(
59+
({ status } = spawnSync(
5560
'npm',
56-
[append ? 'install' : 'uninstall', dev ? '-D' : '-S', ...packages],
61+
[
62+
append ? 'install' : 'uninstall',
63+
dev ? '-D' : '-S',
64+
'--loglevel',
65+
'error',
66+
...packages,
67+
],
5768
{
58-
stdio: 'inherit',
69+
stdio: 'pipe',
5970
cwd,
6071
}
61-
);
72+
));
73+
}
74+
75+
if (status !== 0) {
76+
console.error(chalk.red('Failed to update the dependencies.'));
77+
78+
process.exit(status);
6279
}
6380
}
6481

0 commit comments

Comments
 (0)