#[cfg(test)]
mod tests;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Exit {
Code(i32),
Signal(i32),
TimedOut,
Stopped(Stop),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Stop {
Cancelled,
OverLimit,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Status {
Code(i32),
Signal(i32),
}
impl Status {
#[must_use]
pub const fn shell_code(self) -> i32 {
match self {
Self::Code(code) => code,
Self::Signal(signal) => 128 + signal,
}
}
pub(crate) const fn exit(self) -> Exit {
match self {
Self::Code(code) => Exit::Code(code),
Self::Signal(signal) => Exit::Signal(signal),
}
}
}