pub enum CmdError {
NotFound(String),
Failed {
code: i32,
stderr: String,
},
Io(Error),
}Expand description
Error type for shell command execution failures.
§Variants
NotFound: The command executable was not found on the system PATH. Contains the command string that was attempted.Failed: The command executed but exited with a non-zero status code. Contains the exit code and captured stderr output.Io: The process failed to spawn (e.g., permission denied, fork failure). Wrapsstd::io::Errorfor ergonomic?propagation.
§Invariants
NotFoundis distinct fromFailed: a missing binary vs. a binary that ran and returned an error.Failedalways carries both the exit code and stderr — callers can inspect either for retry decisions.Iowrapsstd::io::ErrorviaFromfor ergonomic?propagation fromCommand::output().
§Errors
This enum IS the error type — no separate error channel exists.
run_cmd returns Result<String, CmdError>.
Variants§
NotFound(String)
Command executable not found on the system PATH.
The string value is the command that was attempted.
Failed
Command executed but exited with a non-zero status code.
code is the process exit code (always non-negative on Unix).
stderr is the captured standard error output, trimmed.
Fields
Io(Error)
Process failed to spawn.
Wraps std::io::Error from Command::output(). Common causes:
permission denied, resource limit reached, fork failure.
Trait Implementations§
Source§impl Error for CmdError
impl Error for CmdError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for CmdError
impl !UnwindSafe for CmdError
impl Freeze for CmdError
impl Send for CmdError
impl Sync for CmdError
impl Unpin for CmdError
impl UnsafeUnpin for CmdError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more