fix: ChildProcess.kill() does not indicate failure when process has already exited - #30931
fix: ChildProcess.kill() does not indicate failure when process has already exited#30931ravibhushan29 wants to merge 1 commit into
ChildProcess.kill() does not indicate failure when process has already exited#30931Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Disabled knowledge base sources:
WalkthroughThis PR refactors the subprocess state tracking mechanism in Bun's subprocess implementation. A new ChangesSubprocess exit state refactor
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The issue demonstrates a compatibility gap with Node.js behavior in Bun's child_process module. The expected behavior shows Node.js returns false from kill() when the process has exited, allowing application code to detect this condition and handle it appropriately. Bun silently succeeds instead, preventing proper error detection. This requires locating Bun's ChildProcess.kill() implementation and ensuring it checks process state before attempting to send signals, returning false when the process has already exited to match Node.js semantics.
Root cause
Bun's implementation of ChildProcess.kill() always returns true when called on an already-exited process, whereas Node.js correctly returns false to indicate the signal could not be sent. This violates the Node.js API contract where kill() should return false when the underlying OS-level kill operation fails (such as when targeting a non-existent PID), allowing callers to detect that the process has already terminated.
Why this approach
The issue demonstrates a compatibility gap with Node.js behavior in Bun's child_process module. The expected behavior shows Node.js returns false from kill() when the process has exited, allowing application code to detect this condition and handle it appropriately. Bun silently succeeds instead, preventing proper error detection. This requires locating Bun's ChildProcess.kill() implementation and ensuring it checks process state before attempting to send signals, returning false when the process has already exited to match Node.js semantics.
Original issue context
Raised autonomously by PatchPilot. The accompanying
PATCHPILOT-fix-*.mdfile in this PR contains the full 8-pass analysis. Review the dashboard for
quality scoring, AI agent comments, and merge confidence.