Expand description
Process abstraction trait used by tools/proc and
tools/long_running.
Tier 1C of the de-flake epic (#1057). Production code spawns through
the ProcessSpawner trait — the default implementation in
process::real wraps std::process::Child and goes through
harn_vm::process_sandbox. Tests install a MockSpawner (see
process::mock) that returns deterministic [MockProcess] handles,
so process-tool tests no longer depend on real subprocess scheduling
or wall-clock timing.
Structs§
- Exit
Status - Resolved exit information for a finished process. Mirrors the subset of
std::process::ExitStatusthat the process-tool builtins surface. - Spawn
Spec - Parameters describing a single spawn. The spawner is responsible for any sandbox setup (Linux seccomp/landlock, macOS sandbox-exec, etc.) and for configuring the child’s process group when requested.
- Spawner
Guard - Guard returned by
install_spawner. Restores the previous spawner on drop so installs nest correctly across tests.
Enums§
- EnvMode
- How a spawn should treat the parent’s environment. Mirrors the legacy
EnvModefromtools/proc.rs. - Process
Error - Errors raised by a spawner. These map onto
HostlibError::Backend/HostlibError::InvalidParameterat the call site so the script-side surface stays unchanged.
Traits§
- Process
Handle - Handle to a running (or finished) process. Used by both the synchronous
proc::runpath and the long-running waiter thread. - Process
Killer - Kill side of a
ProcessHandle. Cloneable viaArcso cancellation works after the waiter thread has taken ownership of the handle itself. - Process
Spawner - Spawner abstraction: produces
ProcessHandleinstances.
Functions§
- current_
spawner - Return the currently installed spawner for this thread, falling back to the default real spawner.
- install_
spawner - Install a per-thread spawner used by
spawn_processfrom this thread. Returns a guard that restores the previous spawner on drop. Tests use this to install asuper::mock::MockSpawner; production never calls it (the default real spawner runs whenever no per-thread spawner is installed). - spawn_
process - Spawn a process via the currently installed spawner.