pub enum ExitStatus {
Exited(i32),
Signaled(Signal, bool),
}Expand description
Describes the result of a process after it has exited.
This is similar to std::process::ExitStatus, but is easier to match
against and provides additional functionality like raise_or_exit that
helps with propagating an exit status.
Variants§
Exited(i32)
Program exited with an exit code.
Signaled(Signal, bool)
Program killed by signal, with or without a coredump.
Implementations§
Source§impl ExitStatus
impl ExitStatus
Sourcepub fn signal(&self) -> Option<i32>
pub fn signal(&self) -> Option<i32>
If the process was terminated by a signal, returns that signal.
Sourcepub fn success(&self) -> bool
pub fn success(&self) -> bool
Was termination successful? Signal termination is not considered a success, and success is defined as a zero exit status.
Sourcepub fn code(&self) -> Option<i32>
pub fn code(&self) -> Option<i32>
Returns the exit code of the process, if any. If the process was
terminated by a signal, this will return None.
Sourcepub fn raise_or_exit(self) -> !
pub fn raise_or_exit(self) -> !
Propagate the exit status such that the current process exits in the same way that the child process exited.
Trait Implementations§
Source§impl Clone for ExitStatus
impl Clone for ExitStatus
impl Copy for ExitStatus
Source§impl Debug for ExitStatus
impl Debug for ExitStatus
Source§impl<'de> Deserialize<'de> for ExitStatus
impl<'de> Deserialize<'de> for ExitStatus
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ExitStatus
Source§impl From<ExitStatus> for ExitStatus
impl From<ExitStatus> for ExitStatus
Source§fn from(status: ExitStatus) -> Self
fn from(status: ExitStatus) -> Self
Converts to this type from the input type.
Source§impl From<ExitStatus> for ExitStatus
impl From<ExitStatus> for ExitStatus
Source§fn from(status: ExitStatus) -> Self
fn from(status: ExitStatus) -> Self
Converts to this type from the input type.
Source§impl Ord for ExitStatus
impl Ord for ExitStatus
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ExitStatus
impl PartialEq for ExitStatus
Source§impl PartialOrd for ExitStatus
impl PartialOrd for ExitStatus
Source§impl Serialize for ExitStatus
impl Serialize for ExitStatus
impl StructuralPartialEq for ExitStatus
Auto Trait Implementations§
impl Freeze for ExitStatus
impl RefUnwindSafe for ExitStatus
impl Send for ExitStatus
impl Sync for ExitStatus
impl Unpin for ExitStatus
impl UnsafeUnpin for ExitStatus
impl UnwindSafe for ExitStatus
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