Skip to content

fix(ext/node): handle signal 0 in child_process.kill()#32294

Merged
bartlomieju merged 5 commits intodenoland:mainfrom
bartlomieju:fix/child-process-kill-signal-zero
Mar 11, 2026
Merged

fix(ext/node): handle signal 0 in child_process.kill()#32294
bartlomieju merged 5 commits intodenoland:mainfrom
bartlomieju:fix/child-process-kill-signal-zero

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

  • child_process.kill(0) threw Unknown signal: 0 because toDenoSignal() didn't recognize signal 0
  • In POSIX, signal 0 checks if a process exists without sending a signal (kill(pid, 0))
  • Now handles signal 0 (both numeric and string "0") as a special case in ChildProcess.kill(), using process.kill(pid, 0) which already supports signal 0
  • This broke npm packages like nuxt that use kill(0) to check if a child process is alive on exit

Closes #25776

Test plan

  • Added regression test: killSignalZero in child_process_test.ts
  • cargo test unit_node::child_process_test passes

🤖 Generated with Claude Code

bartlomieju and others added 5 commits February 23, 2026 19:39
In POSIX, signal 0 is used to check if a process exists without
actually sending a signal. Deno's `toDenoSignal` didn't recognize
signal 0, causing `child.kill(0)` to throw `Unknown signal: 0`.
This broke npm packages like nuxt that use `kill(0)` to check if
a child process is still alive on exit.

Closes denoland#25776

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes resource leak on Windows where the child process wasn't fully
closed before the test ended, causing cascading failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@kajukitli kajukitli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm — signal 0 is a POSIX special case for checking process existence

delegates to process.kill(pid, 0) which already handles this correctly. returns true if process exists, false otherwise. doesn't set killed flag since no signal was actually sent

Copy link
Copy Markdown
Contributor

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 7bcaaa2 into denoland:main Mar 11, 2026
220 of 222 checks passed
@bartlomieju bartlomieju deleted the fix/child-process-kill-signal-zero branch March 11, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:child_process.kill(0) throws

3 participants