Skip to main content

apply_plan_to_command

Function apply_plan_to_command 

Source
pub fn apply_plan_to_command(plan: &RewritePlan, cmd: &mut Command)
Expand description

Wire a RewritePlan into a tokio::process::Command.

Sets the stdin disposition based on whether the plan has a payload — Stdio::piped() when yes, untouched (inherits) when no. The argv override replaces whatever args were on the command. The caller is responsible for .spawn()-ing, writing the payload through child.stdin, and waiting on the child.

Argv override note: this function calls .args(&plan.argv) only if the plan changed the argv (the substitutions list is non-empty). When the plan is a pass-through (no aliases) we leave whatever the caller already set in place.