Skip to content

Commit 111c78d

Browse files
committed
fix(@angular/cli): shut down after first Ctrl+C received
Fixes #9647
1 parent 3be17e7 commit 111c78d

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

packages/@ngtools/webpack/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"npm": ">= 3.0.0"
2626
},
2727
"dependencies": {
28-
"tree-kill": "^1.0.0",
2928
"chalk": "~2.2.0",
3029
"loader-utils": "^1.0.2",
3130
"enhanced-resolve": "^3.1.0",

packages/@ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as path from 'path';
55
import * as ts from 'typescript';
66

77
const ContextElementDependency = require('webpack/lib/dependencies/ContextElementDependency');
8-
const treeKill = require('tree-kill');
98

109
import { WebpackResourceLoader } from './resource_loader';
1110
import { WebpackCompilerHost } from './compiler_host';
@@ -507,29 +506,11 @@ export class AngularCompilerPlugin implements Tapable {
507506
forkOptions);
508507

509508
// Handle child process exit.
510-
const handleChildProcessExit = () => {
511-
this._killForkedTypeChecker();
509+
this._typeCheckerProcess.on('exit', () => {
512510
const msg = 'AngularCompilerPlugin: Forked Type Checker exited unexpectedly. ' +
513511
'Falling back to type checking on main thread.';
514512
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);
525-
}
526-
527-
private _killForkedTypeChecker() {
528-
if (this._typeCheckerProcess && this._typeCheckerProcess.pid) {
529-
treeKill(this._typeCheckerProcess.pid, 'SIGTERM');
530-
this._typeCheckerProcess = undefined;
531-
this._forkTypeChecker = false;
532-
}
513+
});
533514
}
534515

535516
private _updateForkedTypeChecker(rootNames: string[], changedCompilationFiles: string[]) {
@@ -618,7 +599,6 @@ export class AngularCompilerPlugin implements Tapable {
618599
}
619600
callback();
620601
});
621-
compiler.plugin('watch-close', () => this._killForkedTypeChecker());
622602

623603
// Remake the plugin on each compilation.
624604
compiler.plugin('make', (compilation: any, cb: any) => this._make(compilation, cb));

0 commit comments

Comments
 (0)