pub async fn stream_exec_cancellable<C, F>(
codex: &Codex,
cmd: &ExecCommand,
cancel: C,
handler: F,
) -> Result<()>Expand description
Stream JSONL events until the command completes or cancel resolves.
Cancellation terminates the owned process group, waits through the
client’s configured grace period, and reaps the direct child before
returning Error::Cancelled, or Error::CleanupFailed wrapping it if
stopping or reaping the child failed. Shutdown output is drained and discarded;
handlers stop receiving events after cancellation. Detached tools require
the CLI’s cooperation; see crate::CodexBuilder::termination_signal.