pub struct ProcessOutput {
pub stdout: String,
pub stderr: String,
pub stdall: String,
pub exit_code: Option<i32>,
pub signal: Option<String>,
pub duration: Duration,
pub error: Option<ErrorInfo>,
pub from: String,
}Expand description
Fields§
§stdout: StringCaptured standard output.
stderr: StringCaptured standard error.
stdall: StringStandard output and error interleaved in arrival order.
exit_code: Option<i32>Exit code; None when the process was killed by a signal or never ran.
signal: Option<String>Name of the terminating signal (for example SIGTERM).
duration: DurationWall-clock run time.
error: Option<ErrorInfo>Set when the command could not be started.
from: StringWhere the command came from (the command text by default).
Implementations§
Source§impl ProcessOutput
impl ProcessOutput
Sourcepub fn new(
exit_code: Option<i32>,
signal: Option<&str>,
stdout: impl Into<String>,
stderr: impl Into<String>,
stdall: impl Into<String>,
) -> Self
pub fn new( exit_code: Option<i32>, signal: Option<&str>, stdout: impl Into<String>, stderr: impl Into<String>, stdall: impl Into<String>, ) -> Self
Build an output from its main parts.
Sourcepub fn from_error(error: ErrorInfo, from: impl Into<String>) -> Self
pub fn from_error(error: ErrorInfo, from: impl Into<String>) -> Self
An output describing a command that could not be run.
Sourcepub fn with_from(self, from: impl Into<String>) -> Self
pub fn with_from(self, from: impl Into<String>) -> Self
Set the from location used in messages.
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Set the duration.
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, Error>
Parse the combined output as JSON.
Sourcepub fn lines(&self) -> Vec<String>
pub fn lines(&self) -> Vec<String>
Split the combined output on \r?\n, dropping a trailing empty piece.
Sourcepub fn lines_with(&self, delimiter: &str) -> Vec<String>
pub fn lines_with(&self, delimiter: &str) -> Vec<String>
Split the combined output on a custom delimiter.
Sourcepub fn exit_code_info(&self) -> Option<&'static str>
pub fn exit_code_info(&self) -> Option<&'static str>
Description of the exit code (for example Command not found).
Trait Implementations§
Source§impl AsRef<Path> for ProcessOutput
impl AsRef<Path> for ProcessOutput
Source§impl Clone for ProcessOutput
impl Clone for ProcessOutput
Source§impl Debug for ProcessOutput
impl Debug for ProcessOutput
Source§impl Default for ProcessOutput
impl Default for ProcessOutput
Source§impl Display for ProcessOutput
impl Display for ProcessOutput
Source§impl Error for ProcessOutput
impl Error for ProcessOutput
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()
Source§impl IntoIterator for &ProcessOutput
impl IntoIterator for &ProcessOutput
Source§impl IntoZxArg for &ProcessOutput
impl IntoZxArg for &ProcessOutput
Source§fn into_zx_arg(self) -> ZxArg
fn into_zx_arg(self) -> ZxArg
Perform the conversion.
Source§impl IntoZxArg for ProcessOutput
impl IntoZxArg for ProcessOutput
Source§fn into_zx_arg(self) -> ZxArg
fn into_zx_arg(self) -> ZxArg
Perform the conversion.
Source§impl PartialEq for ProcessOutput
impl PartialEq for ProcessOutput
impl StructuralPartialEq for ProcessOutput
Auto Trait Implementations§
impl Freeze for ProcessOutput
impl RefUnwindSafe for ProcessOutput
impl Send for ProcessOutput
impl Sync for ProcessOutput
impl Unpin for ProcessOutput
impl UnsafeUnpin for ProcessOutput
impl UnwindSafe for ProcessOutput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more