Skip to content
1 min read · 209 words

Interface: WrapperGrandchildSpawnedEvent ​

Defined in: src/batteries/llm/claude_code_cli/wire.ts:161

The claude grandchild has just been spawned, detached in its own process group. Emitted once, immediately after spawn() returns and before any stream-json line has been parsed — issue #42 defect #1's additive protocol extension: without this, the adapter's own SIGKILL escalation in gracefulShutdown() could only ever target the wrapper's own pid, never the grandchild's process group, so escalating past a wrapper that ignores SIGTERM would orphan the grandchild's entire group (SIGKILL cannot be caught by any handler, so the wrapper's own process.on('exit', ...) group-cleanup can never run in that case). A consumer/adapter build that predates this event simply never sees it — the union member is additive, and every existing branch keeps working unchanged.

Properties ​

PropertyTypeDescriptionDefined in
pidnumberThe grandchild's OS pid. Spawned with detached: true (its own process group leader), so on POSIX this pid also equals the process group id (pgid) — the adapter negates it (process.kill(-pid, 'SIGKILL')) to signal the whole group, not just this one process.src/batteries/llm/claude_code_cli/wire.ts:169
type"grandchild_spawned"Discriminant for the WrapperEvent union.src/batteries/llm/claude_code_cli/wire.ts:163