Skip to main content

command_for

Function command_for 

Source
pub fn command_for(
    plan: &Plan,
    cwd: &Path,
    child_output: ChildOutput,
) -> Result<Command, EngineError>
Expand description

Build a Command for a Resolved kind, without running it.

This step is split out for testability: tests need output() to capture output, while run inherits stdio.

cwd is only the fallback: a working directory the plugin put in the spec wins, and it is applied here rather than by every caller, so a plugin’s cwd cannot silently depend on the caller remembering to apply it. It is also decided before the program is resolved, so a relative program is looked up in the directory the process will actually run in.