Skip to content

src: fix kill signal on Windows#55514

Merged
nodejs-github-bot merged 4 commits intonodejs:mainfrom
JaneaSystems:huseyin-10409-process-kill-signal
Nov 20, 2024
Merged

src: fix kill signal on Windows#55514
nodejs-github-bot merged 4 commits intonodejs:mainfrom
JaneaSystems:huseyin-10409-process-kill-signal

Conversation

@huseyinacacak-janea
Copy link
Contributor

On Windows, where POSIX signals do not exist, the signal argument will be ignored, and the process will be killed forcefully and abruptly (similar to 'SIGKILL')

As stated in the documentation of Node.js, the signal parameter of child process kill function is ignored.

However, when we execute spawn(process.execPath, ['-v']).kill('SIGHUP');, it throws an exception with the code ENOSYS. This is not consistent with the documentation.

I've looked at the implementation in libuv and have seen that only four signal types are supported to kill a process on Windows.

This PR fixes this issue by changing the signal to SIGKILL if it differs from SIGQUIT, SIGTERM, SIGKILL, and SIGINT. In addition, there is a slight change in the documentation to clarify the signal parameter.

Fixes: #42923

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. child_process Issues and PRs related to the child_process subsystem. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.

7 participants