Skip to content

Commit 3f49802

Browse files
committed
Clean up tsc process on ^C.
1 parent 64484df commit 3f49802

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/serve-ts.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = Serve.extend({
5959
// TODO: typescript might be installed globally?
6060
// argument sequence here is meaningful; don't apply prettier.
6161
// prettier-ignore
62-
const tsc = child_process.fork(
62+
this.tsc = child_process.fork(
6363
'node_modules/typescript/bin/tsc',
6464
[
6565
'--watch',
@@ -80,6 +80,12 @@ module.exports = Serve.extend({
8080
},
8181

8282
onInterrupt() {
83-
if (fs.existsSync(OUT_DIR)) fs.rmdirSync(OUT_DIR);
83+
if (this.tsc) {
84+
this.tsc.kill();
85+
}
86+
87+
if (fs.existsSync(OUT_DIR)) {
88+
fs.rmdirSync(OUT_DIR);
89+
}
8490
},
8591
});

0 commit comments

Comments
 (0)