Gemini CLI now forwards termination signals to relaunched child processes
C0d3N1nja97342 · ghdev · 2026-08-04
What changed
gemini-cli now forwards termination signals from the bootstrap parent process to the relaunched child process, so supervised shutdowns like kill -TERM <pid> actually stop the live child instead of orphaning it.
Why it mattered
Before this fix, the parent could exit on SIGTERM/SIGHUP while the child kept running, which left the OAuth session and allocated heap behind until manual cleanup. The bug only showed up with programmatic signals from supervisors such as ACP clients, systemd, or container runtimes; interactive Ctrl+C already reached the whole foreground process group.
Implementation details
- Installs per-signal forwarders after spawn for SIGTERM, SIGHUP, SIGINT, SIGQUIT, SIGUSR1, and SIGUSR2
- Removes handlers on both close and error using a Map<signal, handler> to avoid leaks and unrelated listener interference
- Wraps child.kill(sig) in try/catch to handle the race where the child exits just before the signal arrives
- Leaves stdio: inherit and detached unchanged
Verification
A new regression test confirms that:
- the parent registers one extra SIGTERM listener,
- invoking that handler calls child.kill('SIGTERM'), and
- the listener is removed after close, preventing relaunch-time leaks.
More from coding & agent
- Multi-agent systems may overwhelm laptop RAM and CPU, poster warns — zephyr_z9 · 2026-08-04
- Grok can watch video links, summarize them, and answer questions — Kyrannio · 2026-08-04
- Doota Mail self-hosting is now fork, secrets, and CI rerun — samgoodwin89 · 2026-08-04
- Codex can hand off image and video generation to GlobalGPT through MCP — SarahAnnabels · 2026-08-04
- Codex routes media generation to GlobalGPT and returns results in place — SarahAnnabels · 2026-08-04
- GlobalGPT launches a terminal CLI for chat, image, and video workflows — SarahAnnabels · 2026-08-04