Skip to main content

Module process

Module process 

Source
Expand description

Owned processes: every child is spawned through rightkit-child-process (process group / Job Object), registered with a Tracker, and killed by recorded pid only. Nothing here ever matches processes by name for killing.

Structs§

Output
RunOptions
Tracker
Registry of every pid a run started, so the run can assert nothing leaked.

Constants§

KILL_HELPER_TIMEOUT
Longest a kill helper (taskkill, kill, pgrep, …) may run before it is abandoned.
TERMINATE_REAP_TIMEOUT
Longest a process-tree termination may wait to reap the leader.

Functions§

fingerprint
ps command line for a pid (unix); the fingerprint that makes a recorded pid safe to kill later without risking an unrelated process that reused it.
is_alive
kill_tree
Terminate pid and its descendants. TERM first, KILL after a short grace.
kill_with_fallback
Run a kill helper (e.g. taskkill) bounded by timeout. When it cannot finish (it overran, or could not start) fallback(pid) runs instead (TerminateProcess on Windows) and a note for the run log is returned; None means the helper finished. Never blocks longer than timeout plus the helper reap.
output_bounded
Run a command for its captured output, waiting at most timeout (pipe draining is bounded too, so a descendant holding a pipe open cannot hang the caller). Ok(None) means it timed out and was killed. Stdin is null.
run_owned
Run to completion with a hard deadline; on timeout the whole tree is killed.
status_bounded
Run a command to completion for its exit status, waiting at most timeout. The command is killed when it overruns. Ok(None) means it timed out. The caller sets stdio.
sweep_registries
Kill processes recorded by earlier runs that are still alive AND still have the exact command line that was recorded. Returns the pids killed.
terminate_bounded
Terminate an owned child’s tree, waiting at most TERMINATE_REAP_TIMEOUT for the leader to be reaped. Returns the exit status when reaped and a run-log note when it was not.