pub struct StepCtx<'a, P>where
P: ProcessManager,{ /* private fields */ }Expand description
Per-step execution context handed to every command handler.
Host-registered functions receive this context: read script state through
the public accessors (get_var, get_env, cwd) and return a Value.
The fields stay crate-private so execution invariants hold for hosts.
Output contract (load-bearing for LET-capture, pipes, and stream assertions):
handlers must emit stdout/stderr ONLY through out/err — via
write_stdout or StreamHandle::to_stdout/to_stderr — and never write
to host stdout directly. The step runner swaps these handles per context:
LET $x: STRING = <command> installs a spillable capture sink, WITH_IO
installs named-pipe endpoints, and the root installs the assertion tee. A handler that bypasses its context handles silently breaks all three.
Implementations§
Source§impl<'a, P> StepCtx<'a, P>where
P: ProcessManager,
impl<'a, P> StepCtx<'a, P>where
P: ProcessManager,
Sourcepub fn get_var(&self, key: &str) -> Option<Value>
pub fn get_var(&self, key: &str) -> Option<Value>
Look up a script variable by name (innermost scope first).
Sourcepub fn get_env(&self, key: &str) -> Option<String>
pub fn get_env(&self, key: &str) -> Option<String>
Look up an environment variable visible to the script.
Sourcepub fn cwd(&self) -> &GuardedPath
pub fn cwd(&self) -> &GuardedPath
Current working directory (guarded; stays inside the workspace).