Expand description
Shell command execution with proper process tree management.
Provides platform-correct process spawning and cleanup:
- Unix: spawns in a dedicated process group via
process_group(0), kills withkillpg(PGID, SIGKILL)to catch compound commands. - Windows: uses
taskkill /F /T /PIDto kill the entire process tree.
The kill_process_tree function is the key correctness primitive: bare
child.kill() only terminates the shell process, leaving grandchildren
(pipelines, && chains) alive as orphans.
Structs§
- Shell
Result - Result of a shell command execution with captured stderr.
Constants§
- STDERR_
CAPTURE_ MAX - Maximum bytes of stderr captured from a shell command.
Functions§
- kill_
process_ tree - Kill a child process and all its descendants.
- run_
with_ timeout - Run a shell command with a timeout (seconds).
- shell_
command - Build a platform-appropriate shell command.