Skip to main content

Module process_tree

Module process_tree 

Source
Expand description

Whole-tree ownership of a spawned command (#1920).

A timeout or cancel has to end every process the command started, not just the shell leader. On Unix callers already isolate the child in its own process group, and killpg reaches every descendant. Windows has no such group: Child::kill ends the shell alone, and a python - it started keeps running detached — spinning a core for hours when its script loops.

A job object is the Windows equivalent. The child is spawned suspended, assigned to a private job and only then resumed, so nothing it starts can escape. TerminateJobObject ends the whole tree at once, and JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE ends it when lean-ctx itself dies before it could clean up.

Structs§

ProcessTree
The process tree of one spawned command. Create it with ProcessTree::start right after spawning a command prepared by ProcessTree::prepare.
StartedShell
A started MCP shell: the process, its output, and what the caller has to show in front of the result, if anything.

Enums§

ShellChild
The shell of one MCP shell call, whoever its parent is.