Skip to main content

Module launch

Module launch 

Source
Expand description

Resolving the program, building the environment, and starting the child.

§Unix replaces, Windows supervises

On Unix prk run calls execvp and becomes the child. Nothing forwards signals, nothing translates exit codes, and SIGTSTP/SIGCONT job control works because there is no longer a prk in the process tree to get it wrong. The only correctness work is in what is inherited across the exec – see crate::signal.

Windows has no exec, so there prk spawns and waits. That reintroduces the two problems Unix does not have, and both are handled explicitly: orphaned grandchildren (a job object with KILL_ON_JOB_CLOSE) and Ctrl-C arriving at prk rather than at the child (a console control handler).

§Argv is never a string

clap’s trailing_var_arg hands over a Vec<OsString> and it reaches Command::args unchanged, which passes it to execvp as a vector. There is no command line to quote and none to parse back, so the entire class of shell-quoting bugs is structurally absent and non-UTF-8 arguments survive byte for byte.

The one exception is a Windows batch shim, where cmd.exe genuinely does interpose a string. That is crate::cmdline, and it is the only place in this crate where an argument is escaped rather than passed.

Structs§

LaunchSpec
Everything needed to start a child process.

Constants§

BATCH_EXTENSIONS
Executable extensions that cmd.exe must interpret rather than the loader.

Functions§

is_batch_target
Whether a resolved program path must be run through cmd.exe.
run
Becomes the child. Never returns on success.