pub fn run(spec: &LaunchSpec) -> Result<Infallible, LaunchError>Expand description
Becomes the child. Never returns on success.
On Unix that is literally true: execvp replaces the process image, so the
only way out is an error. On Windows there is no exec, so this waits for
the child and then exits with its status โ which makes the two platforms
indistinguishable to a caller, and is why the success type is
Infallible.
The alternative โ returning the status for the caller to propagate โ looks tidier and is not: the caller would have to reproduce the exit status exactly through its own error type, and any mapping that cannot represent 126, 127 or a status above 255 silently changes what a script sees.
ยงErrors
See LaunchError. The three cases a caller is expected to distinguish are
LaunchError::NotFound (exit 127), LaunchError::PermissionDenied and
LaunchError::NoExecFormat (both exit 126).