Skip to content

Commit a8fd182

Browse files
committed
Fix Node SIGINT being a string signal
1 parent 3baa348 commit a8fd182

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,17 @@ function resolveColdBoxPlugin(
200200
return;
201201
}
202202

203-
const clean = () => {
203+
const clean = (code: number | null) => {
204204
if (fs.existsSync(hotFile)) {
205205
fs.rmSync(hotFile);
206206
}
207+
process.exit(code ?? 0);
207208
};
208209

209-
process.on("exit", clean);
210-
process.on("SIGINT", process.exit);
211-
process.on("SIGTERM", process.exit);
210+
process.on('exit', (code) => clean(code))
211+
// callback value is signal string, exit with 0
212+
process.on('SIGINT', () => clean(0))
213+
process.on('SIGTERM', () => clean(0))
212214
process.on("SIGHUP", process.exit);
213215

214216
exitHandlersBound = true;

0 commit comments

Comments
 (0)