From 36e83824028ccf76f8da0a5db66b3d73f620e30c Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 28 Jun 2022 13:46:08 +0000 Subject: [PATCH] fix(@ngtools/webpack): restore process title after NGCC is executed More context about this can be found in the following comment: https://github.com/angular/angular-cli/issues/19205#issuecomment-722727791 Closes #19205 --- .../ngtools/webpack/src/ngcc_processor.ts | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/packages/ngtools/webpack/src/ngcc_processor.ts b/packages/ngtools/webpack/src/ngcc_processor.ts index a7e9c2691f37..7a411c3802b3 100644 --- a/packages/ngtools/webpack/src/ngcc_processor.ts +++ b/packages/ngtools/webpack/src/ngcc_processor.ts @@ -117,29 +117,34 @@ export class NgccProcessor { // that we cannot setup multiple cluster masters with different options. // - We will not be able to have concurrent builds otherwise Ex: App-Shell, // as NGCC will create a lock file for both builds and it will cause builds to fails. - const { status, error } = spawnSync( - process.execPath, - [ - this.compilerNgcc.ngccMainFilePath, - '--source' /** basePath */, - this._nodeModulesDirectory, - '--properties' /** propertiesToConsider */, - ...this.propertiesToConsider, - '--first-only' /** compileAllFormats */, - '--create-ivy-entry-points' /** createNewEntryPointFormats */, - '--async', - '--tsconfig' /** tsConfigPath */, - this.tsConfigPath, - '--use-program-dependencies', - ], - { - stdio: ['inherit', process.stderr, process.stderr], - }, - ); + const originalProcessTitle = process.title; + try { + const { status, error } = spawnSync( + process.execPath, + [ + this.compilerNgcc.ngccMainFilePath, + '--source' /** basePath */, + this._nodeModulesDirectory, + '--properties' /** propertiesToConsider */, + ...this.propertiesToConsider, + '--first-only' /** compileAllFormats */, + '--create-ivy-entry-points' /** createNewEntryPointFormats */, + '--async', + '--tsconfig' /** tsConfigPath */, + this.tsConfigPath, + '--use-program-dependencies', + ], + { + stdio: ['inherit', process.stderr, process.stderr], + }, + ); - if (status !== 0) { - const errorMessage = error?.message || ''; - throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`); + if (status !== 0) { + const errorMessage = error?.message || ''; + throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`); + } + } finally { + process.title = originalProcessTitle; } timeEnd(timeLabel);