pub trait ProcessRunner: Send + Sync {
// Required method
fn run(
&self,
program: &str,
args: &[String],
cwd: &Path,
env: &BTreeMap<String, String>,
) -> Result<ProcessOutcome, RunnerError>;
}Expand description
Spawn a child process with an injected environment.
The intent is evault run --project X -- npm start: the runner takes the
resolved environment, spawns npm start, waits for it to exit, and
propagates the exit code. The environment is not materialized to disk.
Required Methods§
Sourcefn run(
&self,
program: &str,
args: &[String],
cwd: &Path,
env: &BTreeMap<String, String>,
) -> Result<ProcessOutcome, RunnerError>
fn run( &self, program: &str, args: &[String], cwd: &Path, env: &BTreeMap<String, String>, ) -> Result<ProcessOutcome, RunnerError>
Run program with the given args, working directory cwd, and an
extra environment overlay env.
The overlay is added to (not replacing) the parent process’s
environment so that PATH and similar variables remain available to
the child. Keys in env override identically-named keys from the
parent.
Implementors MUST strip variables matching the EVAULT_* prefix
from the parent environment before applying the overlay, so that
internal runtime configuration (master key paths, telemetry knobs)
does not leak into untrusted child processes.
Implementors MUST validate every supplied key (same shape as a
variable name) and reject values containing a NUL byte before
touching std::process::Command — a NUL would terminate the OS
environment block early and is non-recoverable.
§Errors
Returns RunnerError::Invalid when the env overlay contains a
malformed key or a value with a NUL byte;
RunnerError::Spawn if the process could not start;
RunnerError::Io for IO failure during execution.