pub struct Status(pub ExitStatus);
Expand description
Use Status
as the return type for run_output!
to retrieve the
ExitStatus
of the child process:
use cradle::prelude::*;
let Status(exit_status) = run_output!(%"echo foo");
assert!(exit_status.success());
Also, when using Status
, non-zero exit codes won’t
result in neither a panic (when used with run!
or
run_output!
) nor an std::result::Result::Err
(when used with run_result!
):
use cradle::prelude::*;
let Status(exit_status) = run_output!("false");
assert_eq!(exit_status.code(), Some(1));
let result: Result<Status, cradle::Error> = run_result!("false");
assert!(result.is_ok());
assert_eq!(result.unwrap().0.code(), Some(1));
Also see the section about error handling in the module documentation.
Tuple Fields
0: ExitStatus
Trait Implementations
sourceimpl Output for Status
impl Output for Status
sourcefn from_child_output(
config: &Config,
result: &ChildOutput
) -> Result<Self, Error>
fn from_child_output(
config: &Config,
result: &ChildOutput
) -> Result<Self, Error>
Converts ChildOutput
s
from running a child process into values of the Output
type.
This is an internal function that should be ignored. Read more
Auto Trait Implementations
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more