#[non_exhaustive]pub enum RunCommandError {
#[non_exhaustive] IncompleteRun {
invocation: Box<Invocation>,
source: Error,
},
#[non_exhaustive] UnstartableCommand {
invocation: Box<Invocation>,
source: Error,
},
}Expand description
The error returned when a command does not run
The variants separate what happened to the command. A command that never started needs a program that exists, a working directory that exists, and the rights to start a program. A run that started and did not finish means that the operating system stopped the crate from collecting the result, which a caller reports and can try again.
A command that ran and ended without success is no failure of the run. The result then carries the status, and the caller decides what it means.
The invocation travels in a box. A result carries its error by value, so the size of the error reaches every function that returns one. The box keeps the error small, and a caller that wraps it in an error of its own needs no box for it.
A later release can add variants, and it can add fields to a variant.
Match with a wildcard arm, and bind the fields of a variant with ...
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]IncompleteRun
The command started and the run did not finish
The program ran, and reading one of its streams or waiting for its end failed. Nothing of the run survives such a failure, so the crate reports it instead of a result with holes in it. The command itself can still have done its work.
Fields
This variant is marked as non-exhaustive
invocation: Box<Invocation>The command that did not finish
#[non_exhaustive]UnstartableCommand
The command did not start
No program answers to the name, the working directory does not exist, or the operating system refused to start the program. Nothing ran, so there is no status and no output to report.
Fields
This variant is marked as non-exhaustive
invocation: Box<Invocation>The command that did not start
Trait Implementations§
Source§impl Debug for RunCommandError
impl Debug for RunCommandError
Source§impl Display for RunCommandError
impl Display for RunCommandError
Source§impl Error for RunCommandError
impl Error for RunCommandError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()