Skip to main content

Module handle

Module handle 

Source
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§

ExitStatus
Resolved exit information for a finished process. Mirrors the subset of std::process::ExitStatus that the process-tool builtins surface.
SpawnSpec
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.
SpawnerGuard
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 EnvMode from tools/proc.rs.
ProcessError
Errors raised by a spawner. These map onto HostlibError::Backend / HostlibError::InvalidParameter at the call site so the script-side surface stays unchanged.

Traits§

ProcessHandle
Handle to a running (or finished) process. Used by both the synchronous proc::run path and the long-running waiter thread.
ProcessKiller
Kill side of a ProcessHandle. Cloneable via Arc so cancellation works after the waiter thread has taken ownership of the handle itself.
ProcessSpawner
Spawner abstraction: produces ProcessHandle instances.

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_process from this thread. Returns a guard that restores the previous spawner on drop. Tests use this to install a super::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.