pub struct ExitStatus(pub c_int);Expand description
Number that summarizes the result of command execution.
An exit status is an integer returned from a utility (or command) when executed. It usually is a summarized result of the execution. Many utilities return an exit status of zero when successful and non-zero otherwise.
In the shell language, the special parameter $? expands to the exit status
of the last executed command. Exit statuses also affect the behavior of some
compound commands.
Tuple Fields§
§0: c_intImplementations§
Source§impl ExitStatus
impl ExitStatus
Sourcepub fn to_signal<S: System + ?Sized>(
self,
system: &S,
exact: bool,
) -> Option<(Name, Number)>
pub fn to_signal<S: System + ?Sized>( self, system: &S, exact: bool, ) -> Option<(Name, Number)>
Returns the signal name and number corresponding to the exit status.
This function is the inverse of the From<signal::Number> implementation
for ExitStatus. It tries to find a signal name and number by offsetting
the exit status by 384. If the offsetting does not result in a valid signal
name and number, it additionally tries with 128 and 0 unless exact is
true.
If self is not a valid signal exit status, this function returns None.
Source§impl ExitStatus
impl ExitStatus
Sourcepub const SUCCESS: ExitStatus
pub const SUCCESS: ExitStatus
Exit status of 0: success
Sourcepub const FAILURE: ExitStatus
pub const FAILURE: ExitStatus
Exit status of 1: failure
Sourcepub const ERROR: ExitStatus
pub const ERROR: ExitStatus
Exit status of 2: error severer than failure
Sourcepub const NOEXEC: ExitStatus
pub const NOEXEC: ExitStatus
Exit Status of 126: command not executable
Sourcepub const NOT_FOUND: ExitStatus
pub const NOT_FOUND: ExitStatus
Exit status of 127: command not found
Sourcepub const READ_ERROR: ExitStatus
pub const READ_ERROR: ExitStatus
Exit status of 128: unrecoverable read error
Sourcepub const fn is_successful(&self) -> bool
pub const fn is_successful(&self) -> bool
Returns true if and only if self is zero.
Trait Implementations§
Source§impl Clone for ExitStatus
impl Clone for ExitStatus
Source§fn clone(&self) -> ExitStatus
fn clone(&self) -> ExitStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExitStatus
impl Debug for ExitStatus
Source§impl Default for ExitStatus
impl Default for ExitStatus
Source§fn default() -> ExitStatus
fn default() -> ExitStatus
Source§impl Display for ExitStatus
impl Display for ExitStatus
Source§impl From<ExitStatus> for Result
impl From<ExitStatus> for Result
Source§fn from(exit_status: ExitStatus) -> Self
fn from(exit_status: ExitStatus) -> Self
Source§impl From<ExitStatus> for c_int
impl From<ExitStatus> for c_int
Source§fn from(exit_status: ExitStatus) -> c_int
fn from(exit_status: ExitStatus) -> c_int
Source§impl From<Number> for ExitStatus
Converts a signal number to the corresponding exit status.
impl From<Number> for ExitStatus
Converts a signal number to the corresponding exit status.
POSIX requires the exit status to be greater than 128. The current
implementation returns signal_number + 384.
See ExitStatus::to_signal for the reverse conversion.
Source§impl From<ProcessResult> for ExitStatus
Converts ProcessResult to ExitStatus.
impl From<ProcessResult> for ExitStatus
Converts ProcessResult to ExitStatus.
Source§fn from(result: ProcessResult) -> Self
fn from(result: ProcessResult) -> Self
Source§impl From<i32> for ExitStatus
impl From<i32> for ExitStatus
Source§fn from(value: c_int) -> ExitStatus
fn from(value: c_int) -> ExitStatus
Source§impl Hash for ExitStatus
impl Hash for ExitStatus
Source§impl Ord for ExitStatus
impl Ord for ExitStatus
Source§fn cmp(&self, other: &ExitStatus) -> Ordering
fn cmp(&self, other: &ExitStatus) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ExitStatus
impl PartialEq for ExitStatus
Source§impl PartialOrd for ExitStatus
impl PartialOrd for ExitStatus
Source§impl Termination for ExitStatus
Converts the exit status to ExitCode.
impl Termination for ExitStatus
Converts the exit status to ExitCode.
Note that ExitCode only supports exit statuses in the range of 0 to 255.
Only the lowest 8 bits of the exit status are used in the conversion.
Source§impl TryFrom<ProcessState> for ExitStatus
Converts ProcessState to ExitStatus.
impl TryFrom<ProcessState> for ExitStatus
Converts ProcessState to ExitStatus.
For the Running state, the conversion fails with RunningProcess.
Source§type Error = RunningProcess
type Error = RunningProcess
Source§fn try_from(state: ProcessState) -> Result<Self, RunningProcess>
fn try_from(state: ProcessState) -> Result<Self, RunningProcess>
impl Copy for ExitStatus
impl Eq 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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