@@ -504,28 +504,24 @@ export class AngularCompilerPlugin implements Tapable {
504
504
forkOptions ) ;
505
505
506
506
// Handle child process exit.
507
- const handleChildProcessExit = ( ) => {
508
- this . _killForkedTypeChecker ( ) ;
509
- const msg = 'AngularCompilerPlugin: Forked Type Checker exited unexpectedly. ' +
510
- 'Falling back to type checking on main thread.' ;
511
- this . _warnings . push ( msg ) ;
512
- } ;
513
- this . _typeCheckerProcess . once ( 'exit' , handleChildProcessExit ) ;
514
- this . _typeCheckerProcess . once ( 'SIGINT' , handleChildProcessExit ) ;
515
- this . _typeCheckerProcess . once ( 'uncaughtException' , handleChildProcessExit ) ;
516
-
517
- // Handle parent process exit.
518
- const handleParentProcessExit = ( ) => this . _killForkedTypeChecker ( ) ;
519
- process . once ( 'exit' , handleParentProcessExit ) ;
520
- process . once ( 'SIGINT' , handleParentProcessExit ) ;
521
- process . once ( 'uncaughtException' , handleParentProcessExit ) ;
507
+ this . _typeCheckerProcess . once ( 'exit' , ( _ , signal ) => {
508
+ this . _typeCheckerProcess = undefined ;
509
+
510
+ // If process exited not because of SIGTERM (see _killForkedTypeChecker), than something
511
+ // went wrong and it should fallback to type checking on the main thread.
512
+ if ( signal !== 'SIGTERM' ) {
513
+ this . _forkTypeChecker = false ;
514
+ const msg = 'AngularCompilerPlugin: Forked Type Checker exited unexpectedly. ' +
515
+ 'Falling back to type checking on main thread.' ;
516
+ this . _warnings . push ( msg ) ;
517
+ }
518
+ } ) ;
522
519
}
523
520
524
521
private _killForkedTypeChecker ( ) {
525
522
if ( this . _typeCheckerProcess && this . _typeCheckerProcess . pid ) {
526
523
treeKill ( this . _typeCheckerProcess . pid , 'SIGTERM' ) ;
527
524
this . _typeCheckerProcess = undefined ;
528
- this . _forkTypeChecker = false ;
529
525
}
530
526
}
531
527
0 commit comments