pub struct ProcessError {
pub desc: String,
pub code: Option<i32>,
pub stdout: Option<Vec<u8>>,
pub stderr: Option<Vec<u8>>,
}
Fields§
§desc: String
A detailed description to show to the user why the process failed.
code: Option<i32>
The exit status of the process.
This can be None
if the process failed to launch (like process not
found) or if the exit status wasn’t a code but was instead something
like termination via a signal.
stdout: Option<Vec<u8>>
The stdout from the process.
This can be None
if the process failed to launch, or the output was
not captured.
stderr: Option<Vec<u8>>
The stderr from the process.
This can be None
if the process failed to launch, or the output was
not captured.
Implementations§
source§impl ProcessError
impl ProcessError
sourcepub fn new(
msg: &str,
status: Option<ExitStatus>,
output: Option<&Output>,
) -> ProcessError
pub fn new( msg: &str, status: Option<ExitStatus>, output: Option<&Output>, ) -> ProcessError
Creates a new ProcessError
.
status
can beNone
if the process did not launch.output
can beNone
if the process did not launch, or output was not captured.
sourcepub fn new_raw(
msg: &str,
code: Option<i32>,
status: &str,
stdout: Option<&[u8]>,
stderr: Option<&[u8]>,
) -> ProcessError
pub fn new_raw( msg: &str, code: Option<i32>, status: &str, stdout: Option<&[u8]>, stderr: Option<&[u8]>, ) -> ProcessError
Creates a new ProcessError
with the raw output data.
code
can beNone
for situations like being killed by a signal on unix.
sourcepub fn could_not_execute(cmd: impl Display) -> ProcessError
pub fn could_not_execute(cmd: impl Display) -> ProcessError
Creates a ProcessError
with “could not execute process {cmd}”.
cmd
is usually but not limited tostd::process::Command
.
Trait Implementations§
source§impl Debug for ProcessError
impl Debug for ProcessError
source§impl Display for ProcessError
impl Display for ProcessError
source§impl Error for ProcessError
impl Error for ProcessError
1.30.0 · 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 Freeze for ProcessError
impl RefUnwindSafe for ProcessError
impl Send for ProcessError
impl Sync for ProcessError
impl Unpin for ProcessError
impl UnwindSafe for ProcessError
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