Repository navigation
subprocess: list valid signal names in kill() error - #30982
Conversation
|
Updated 7:50 AM PT - May 18th, 2026
✅ @alii, your commit 53af7e836b6f843f8c48b7dcc8574b70ae796bbf passed in 🧪 To try this PR locally: bunx bun-pr 30982That installs a local version of the PR into your bun-30982 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR improves error messages when invalid signal names are passed to subprocess kill operations. The ChangesSignal validation error messages with enumerated names
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
LGTM — restores the enumerated signal-name error message with test coverage.
Extended reasoning...
Overview
This PR touches two files: src/jsc/lib.rs (the FromJsEnum impl for bun_sys::SignalCode) and test/js/bun/spawn/spawn-kill-signal.test.ts. It replaces a terse placeholder error message (signal must be one of the SignalCode names) with the full enumerated list ('SIGHUP', 'SIGINT', … or 'SIGSYS'), restoring byte-for-byte parity with released Bun's Zig toEnumFromMap behavior.
Security risks
None. This is a cold-path error-message formatter that only runs when a user passes an invalid signal string to subprocess.kill(). It reads from a static [&str; 32] constant (bun_core::SIGNAL_NAMES), allocates a small String, and throws. No user-controlled data flows into the message construction beyond triggering the branch.
Level of scrutiny
Low. The change is mechanical string-building over a compile-time-fixed array. I verified SIGNAL_NAMES is [""; SIGHUP..SIGSYS] (32 entries, index 0 sentinel), so [1..] yields exactly 31 names with SIGHUP first and SIGSYS last. The join logic correctly produces ', ' separators with or ' before the final entry, and the array is guaranteed non-empty so the leading ' is always closed.
Other factors
A new regression test asserts the message contains 'SIGHUP', 'SIGTERM', 'SIGKILL', and or 'SIGSYS' while excluding the old placeholder text, and still verifies the process is killable afterward. No bugs were flagged by the bug-hunting system, and there are no outstanding reviewer comments.
|
@robobun fix review comments |
|
@alii I couldn't find any open review comments to address — both reviewers approved with no actionable items:
CI is green on Build #55809. If there's specific feedback you'd like addressed, let me know and I'll get on it. |
subprocess.kill("BADSIGNAL")lost its useful error message in the Rust port: it emitted the static placeholdersignal must be one of the SignalCode names(naming zero actual signals) instead of the full list released Bun produces.Build the list from the canonical signal X-macro (matching Zig's comptime
toEnumFromMap), so the message is byte-for-byte identical to released Bun again:signal must be one of 'SIGHUP', 'SIGINT', … or 'SIGSYS'.code/namewere already correct.