Skip to main content

Crate bounded_command

Crate bounded_command 

Source
Expand description

Deadline- and allocation-bounded subprocess execution.

Privileged components use small command-line clients at a few platform boundaries; this wrapper keeps a wedged client, a compromised daemon or an inherited pipe in a descendant from pinning or exhausting its caller.

Modules§

command
The Command helpers domains share: which, run and bounded capture with one error vocabulary. Native only: the page’s build links this crate through the UI’s speech engine, and a browser page has no subprocesses to look up or start. The Command helpers Tilo’s domains share: bounded subprocess execution, so every shell-out shares one error vocabulary (missing binary, non-zero exit, spawn failure) and hands it straight to tracing::warn!.

Structs§

AsyncCommand
A nonblocking bounded command which cancels its process group when dropped.
Output
WakeFd
A level-triggered wake descriptor: readable from the first ring until drain. A supervisor passes fd to wait_child_or; any thread rings it after changing what the supervisor must re-check.

Enums§

Error
StderrObservation
An informational copy of bytes the owned stderr capture already read. Capture stays authoritative; overflow disables only this queue.
Wakeup

Constants§

MAX_INPUT_BYTES
Maximum secret or request body this wrapper accepts.
STDERR_OBSERVATION_CHUNKS

Functions§

kill_tree
Kill a child started with own_process_tree together with its descendants, and the child itself as a fallback. The caller still reaps it.
make_executable
Mark a script or program file executable for everyone and writable only by its owner (mode 0755 on Unix). A no-op where executability is not a file permission.
own_process_tree
Start command’s child as the leader of its own process tree, so kill_tree also reaches every descendant it starts. On Unix this is a new process group named after the child’s pid.
run
Run one fixed program/argv transaction with bounded input, output, and time.
run_os
run_prepared
Run a caller-prepared command, replacing its standard streams and process-group configuration with the bounded policy.
run_prepared_with_input_limit
Run a prepared command with caller-selected input and stream ceilings, for bounded bulk payloads such as print documents. Most callers want run_prepared.
run_prepared_with_limits
Run a caller-prepared command with independent output-stream ceilings, for helpers whose primary output is legitimately much larger than their diagnostics, such as image acquisition tools.
run_prepared_with_stdin
Run a prepared command reading file as its standard input: a handle the caller holds (a file the person chose) given to the program as it is, rather than a path it would open itself.
run_with_env
spawn_prepared
Spawn a caller-prepared bounded command for nonblocking polling. Dropping the handle cancels and reaps the process group.
spawn_prepared_observing_stderr
Spawn with a bounded nonblocking copy of the owned stderr capture.
terminate_tree
Stop a child started with own_process_tree and reap it. With a non-zero grace, the tree is first asked to exit (SIGTERM on Unix) and gets that long to do so: until the child and, on Unix, every process left in its group are gone. Whatever remains is then killed with kill_tree.
wait_child_or
Wait until child exits, wake becomes readable, or deadline passes, without polling. With neither a wake descriptor nor a deadline this blocks until the child exits; a deadline already in the past only probes.
wait_or_kill
wait_timeout, then kill and reap a child still running at the deadline. None when it had to be killed.
wait_timeout
Wait up to timeout for child to exit, and reap it. None when it is still running at the deadline; it is left running. On Unix this sleeps in wait_child_or rather than polling.
without_console_window
Start command’s child without a console window of its own. On Windows a console program otherwise opens one; elsewhere this changes nothing.