If pre_exec only calls setsid, just pass posix_spawn's flag instead
charliermarsh · x · 2026-11-25
A concrete trick: some of Codex's preexec callbacks merely called setsid to start a new session — but posixspawn supports this natively, so you can just pass the flag instead and avoid the fork fallback.
Related event: Codex Builds Custom Rust Command Abstraction to Avoid Fork Fallback(2 posts)→
More from coding & agent
- Next.js Nights Berlin on Dec 2 to cover Go support, native routes, and agent-ready framework — evilrabbit_ · 2026-11-25
- OpenAI open-sources fix for Codex MCP server spawning reliability on macOS — charliermarsh · 2026-11-25
- Codex built its own Rust Command abstraction to stay on posix_spawn — charliermarsh · 2026-11-25
- Rust's std usually uses posix_spawnp under the hood — with exceptions — charliermarsh · 2026-11-25
- fork's copy-on-write still copies page tables, slowing big processes — charliermarsh · 2026-11-25
- Codex cuts process spawn time 800x to 0.25ms via direct posix_spawn — charliermarsh · 2026-11-25