Struct cradle::Exit [−][src]
pub struct Exit(pub ExitStatus);
Trait Implementations
Using Exit
as the return type for cmd!
allows to
retrieve the ExitStatus
of the child process:
use cradle::*; let Exit(status) = cmd!(%"echo foo"); assert!(status.success());
Also, when using Exit
, non-zero exit codes won’t
result in neither a panic nor a std::result::Result::Err
:
use cradle::*; let Exit(status) = cmd!("false"); assert_eq!(status.code(), Some(1)); let result: Result<Exit, cradle::Error> = cmd_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.
Auto Trait Implementations
impl RefUnwindSafe for Exit
impl UnwindSafe for Exit