Skip to content

Commit

Permalink
fix(@angular/cli): disable update notifier when retrieving package ma…
Browse files Browse the repository at this point in the history
…nager version during `ng version`

NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.

Closes #21172

(cherry picked from commit 88ee85c)
  • Loading branch information
alan-agius4 committed Jun 25, 2021
1 parent d9fc971 commit e2375c9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/angular/cli/commands/version-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,16 @@ export class VersionCommand extends Command<VersionCommandSchema> {
private async getPackageManager(): Promise<string> {
try {
const manager = await getPackageManager(this.context.root);
const version = execSync(`${manager} --version`, { encoding: 'utf8', stdio: 'pipe' }).trim();
const version = execSync(`${manager} --version`, {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
env: {
...process.env,
// NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
NO_UPDATE_NOTIFIER: '1',
NPM_CONFIG_UPDATE_NOTIFIER: 'false',
},
}).trim();

return `${manager} ${version}`;
} catch {
Expand Down

0 comments on commit e2375c9

Please sign in to comment.