Skip to content

fix(spawnSync): throw instead of segfaulting when event-loop creation fails - #35033

Open
robobun wants to merge 4 commits into
mainfrom
farm/3482e701/spawnsync-loop-init-null
Open

fix(spawnSync): throw instead of segfaulting when event-loop creation fails#35033
robobun wants to merge 4 commits into
mainfrom
farm/3482e701/spawnsync-loop-init-null

address review: fix macOS async cleanup, update stale SAFETY comment,…

106b2a9
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 22, 2026 in 12m 32s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/api/bun/js_bun_spawn_bindings.rs:2093-2107 Hardcoded EMFILE / uv_loop_init in spawnSync loop-init error is inaccurate on POSIX

Annotations

Check warning on line 2107 in src/runtime/api/bun/js_bun_spawn_bindings.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Hardcoded EMFILE / uv_loop_init in spawnSync loop-init error is inaccurate on POSIX

The hardcoded `syscall: "uv_loop_init"` and `code: "EMFILE"` are inaccurate on POSIX — the failing syscall there is `epoll_create1`/`kqueue`/`eventfd` (libuv isn't in the picture), and the errno may be `ENFILE` rather than `EMFILE`. Since `us_create_loop` discards the real errno by returning `NULL`, the true cause can't be recovered here — but a Linux/macOS user seeing `syscall: "uv_loop_init"` will be misled. Consider `cfg`-gating the syscall string per platform, or leaving `syscall` empty (as