@@ -504,28 +504,24 @@ export class AngularCompilerPlugin implements Tapable {
504504 forkOptions ) ;
505505
506506 // 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+ } ) ;
522519 }
523520
524521 private _killForkedTypeChecker ( ) {
525522 if ( this . _typeCheckerProcess && this . _typeCheckerProcess . pid ) {
526523 treeKill ( this . _typeCheckerProcess . pid , 'SIGTERM' ) ;
527524 this . _typeCheckerProcess = undefined ;
528- this . _forkTypeChecker = false ;
529525 }
530526 }
531527
0 commit comments