Skip to content

Commit 389bf3f

Browse files
src: fix kill signal 0 on Windows
This special case was missed in the previous changes to this file. Refs: #55514 Refs: #42923 Fixes: #57669
1 parent b4280ef commit 389bf3f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/process_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class ProcessWrap : public HandleWrap {
385385
}
386386
#ifdef _WIN32
387387
if (signal != SIGKILL && signal != SIGTERM && signal != SIGINT &&
388-
signal != SIGQUIT) {
388+
signal != SIGQUIT && signal != 0) {
389389
signal = SIGKILL;
390390
}
391391
#endif

test/parallel/test-child-process-kill.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@ if (common.isWindows) {
6060
});
6161
process.kill('SIGHUP');
6262
}
63+
64+
// Test that the process is not killed when sending a 0 signal.
65+
// This is a no-op signal that is used to check if the process is alive.
66+
const checkProcess = spawn(process.execPath, ['-e', 'setTimeout(() => {}, 1000)']);
67+
checkProcess.on('exit', (code, signal) => {
68+
assert.strictEqual(code, 0);
69+
assert.strictEqual(signal, null);
70+
});
71+
checkProcess.kill(0);

0 commit comments

Comments
 (0)