Skip to main content

command_for_spawn

Function command_for_spawn 

Source
pub fn command_for_spawn(
    program: &OsStr,
    child_path: ChildPath<'_>,
    cwd: Option<&Path>,
) -> Command
Expand description

Create a Command for program that stays on the posix_spawn path when the program can be resolved the way the child would resolve it.

When the program is rewritten to an absolute path, argv[0] keeps the original program. Otherwise the command is exactly Command::new(program), so launch behavior and errors are unchanged.