pub struct ProcessResult<T> { /* private fields */ }Expand description
The captured result of running a process to completion.
T is the standard-output payload: String for the text helpers
(output_string) or Vec<u8> for the raw-bytes helper (output_bytes).
Standard error is always captured as text. A non-zero exit code is not
treated as an error on its own — inspect exit_code or
call ensure_success.
Implementations§
Source§impl<T> ProcessResult<T>
impl<T> ProcessResult<T>
Sourcepub fn into_stdout(self) -> T
pub fn into_stdout(self) -> T
Consume the result and return just the captured standard output.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Whether the process exited with code 0.
Sourcepub fn ensure_success(self) -> Result<ProcessResult<T>, Error>
pub fn ensure_success(self) -> Result<ProcessResult<T>, Error>
Return self unchanged when the run succeeded, otherwise the matching
error: Error::Timeout if the run was killed by its deadline (checked
first — a timed-out run has no meaningful exit code), else
Error::Exit for a non-zero exit, carrying the code and (truncated)
standard error.
Mirrors the .NET EnsureSuccess() / ProcessExitException.
Trait Implementations§
Source§impl<T> Clone for ProcessResult<T>where
T: Clone,
impl<T> Clone for ProcessResult<T>where
T: Clone,
Source§fn clone(&self) -> ProcessResult<T>
fn clone(&self) -> ProcessResult<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for ProcessResult<T>where
T: Debug,
impl<T> Debug for ProcessResult<T>where
T: Debug,
Source§impl<T> PartialEq for ProcessResult<T>where
T: PartialEq,
impl<T> PartialEq for ProcessResult<T>where
T: PartialEq,
Source§fn eq(&self, other: &ProcessResult<T>) -> bool
fn eq(&self, other: &ProcessResult<T>) -> bool
self and other values to be equal, and is used by ==.