Skip to main content

load_command

Function load_command 

Source
pub fn load_command(path: &Path) -> Result<CommandSpec, String>
Expand description

Reads and validates a command specification.

The file schema is {"format_version":1,"program":"cargo","args":["test"],"env":{"NAME":"value"}} with env optional and empty by default, plus an optional "timeout_seconds" bounding each run’s wall clock (absent = wait forever). Its raw bytes are hashed so a ledger cannot silently mix command versions; because env lives in those bytes, a declared-environment change is a command change, and so is a timeout change.

§Errors

The file is unreadable, malformed, has the wrong version, has an empty program/non-string argument, declares an environment entry whose name is empty or contains = or NUL, declares a zero or non-integer timeout_seconds, or gives Cargo a target directory outside the current revision worktree.