@@ -5,7 +5,6 @@ import * as path from 'path';
5
5
import * as ts from 'typescript' ;
6
6
7
7
const ContextElementDependency = require ( 'webpack/lib/dependencies/ContextElementDependency' ) ;
8
- const treeKill = require ( 'tree-kill' ) ;
9
8
10
9
import { WebpackResourceLoader } from './resource_loader' ;
11
10
import { WebpackCompilerHost } from './compiler_host' ;
@@ -507,26 +506,20 @@ export class AngularCompilerPlugin implements Tapable {
507
506
forkOptions ) ;
508
507
509
508
// 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 ) ;
509
+ this . _typeCheckerProcess . once ( 'exit' , ( _ , signal ) => {
510
+ this . _typeCheckerProcess = undefined ;
511
+ this . _forkTypeChecker = false ;
512
+ if ( signal !== 'SIGTERM' ) {
513
+ const msg = 'AngularCompilerPlugin: Forked Type Checker exited unexpectedly. ' +
514
+ 'Falling back to type checking on main thread.' ;
515
+ this . _warnings . push ( msg ) ;
516
+ }
517
+ } ) ;
525
518
}
526
519
527
520
private _killForkedTypeChecker ( ) {
528
- if ( this . _typeCheckerProcess && this . _typeCheckerProcess . pid ) {
529
- treeKill ( this . _typeCheckerProcess . pid , 'SIGTERM' ) ;
521
+ if ( this . _typeCheckerProcess ) {
522
+ this . _typeCheckerProcess . kill ( 'SIGTERM' ) ;
530
523
this . _typeCheckerProcess = undefined ;
531
524
this . _forkTypeChecker = false ;
532
525
}
0 commit comments