Skip to main content

kill_child_and_group

Function kill_child_and_group 

Source
pub async fn kill_child_and_group(child: &mut Child) -> Result<()>
Expand description

Force-kill a child and, on Unix, the process group it leads: what an agent CLI spawned with process_group(0) needs, since its MCP servers and other helpers live in that group, not in srv’s. Then reap it.

The group is signalled only while tokio hasn’t reaped the child (id() is Some until then), so the pid, and the group it names, are still this child’s and can’t have been reused. A child that doesn’t lead its own group (spawned without process_group(0)) gets only the single-pid kill, as before: its group is srv’s.