Skip to content

Commit 49817f0

Browse files
committed
fix(@angular/cli): only show add/update package install output on errors
Closes angular#16014 Closes angular#16027
1 parent e70a2b0 commit 49817f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/angular/cli/tasks/install-package.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,24 @@ export function installPackage(
5858
}
5959
}
6060

61-
const { status } = spawnSync(
61+
const { status, stderr } = spawnSync(
6262
packageManager,
6363
[
6464
...installArgs,
6565
...extraArgs,
6666
],
6767
{
68-
stdio: 'inherit',
69-
shell: true,
68+
stdio: 'pipe',
69+
encoding: 'utf8',
7070
},
7171
);
7272

7373
if (status !== 0) {
74-
throw new Error('Package install failed, see above.');
74+
let errors = stderr.trim();
75+
if (errors.length) {
76+
errors += '\n';
77+
}
78+
throw new Error(errors + `Package install failed${errors.length ? ', see above' : ''}.`);
7579
}
7680

7781
logger.info(colors.green(`Installed packages for tooling via ${packageManager}.`));

0 commit comments

Comments
 (0)