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