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§
- Launch
Spec - Everything needed to start a child process.
Constants§
- BATCH_
EXTENSIONS - Executable extensions that
cmd.exemust 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.