Expand description
Shell-free process groups and bounded I/O, extracted/adapted from route_agent.
Functions§
- bounded_
command - Runs
argvwithout a shell in its own process group, writesinputto its standard input, and returns its exit status, standard output and standard error. Fails withTimedOutaftertimeout, and when either stream exceedsmaximumbytes. The group is killed when the command ends. - bounded_
command_ until bounded_commandthat also stops the command’s process group, with anInterruptederror, as soon asabortreturns true. The command runs in its own group, so a terminal’s SIGINT to the caller does not reach it.- drain
- Keep draining beyond the limit to avoid pipe deadlocks; never retain excess bytes.
- drain_
file - Bounded on-disk diagnostics, with pipes drained after cap is reached.
- group
- Puts the command in a process group of its own, so that
terminate_process_groupalso reaches its descendants. - group_
stopped - Check Linux process-group membership, counting zombies as already stopped. Returns an error when liveness cannot be established. Escaped sessions are outside the foreground backend’s contract; use systemd for containment.
- terminate_
process_ group - Kills the child’s process group with SIGKILL, then the child itself.