From 88ee85c4178e37b72001e8946b70a46ba739a0b7 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 24 Jun 2021 16:39:17 +0200 Subject: [PATCH] fix(@angular/cli): disable update notifier when retrieving package manager version during `ng version` NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes. Closes #21172 --- packages/angular/cli/commands/version-impl.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/angular/cli/commands/version-impl.ts b/packages/angular/cli/commands/version-impl.ts index 757f28e10ade..4503cfdc84cd 100644 --- a/packages/angular/cli/commands/version-impl.ts +++ b/packages/angular/cli/commands/version-impl.ts @@ -182,7 +182,16 @@ export class VersionCommand extends Command { private async getPackageManager(): Promise { 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 {