Skip to content

Commit

Permalink
fix(@ngtools/webpack): restore process title after NGCC is executed
Browse files Browse the repository at this point in the history
More context about this can be found in the following comment: #19205 (comment)

Closes #19205

(cherry picked from commit 7ababc2)
  • Loading branch information
alan-agius4 authored and clydin committed Jun 28, 2022
1 parent 6d47821 commit 33f1cc1
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions packages/ngtools/webpack/src/ngcc_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 33f1cc1

Please sign in to comment.