pub struct ExitInfo {
pub code: Option<i32>,
pub signal: Option<i32>,
}Expand description
Why a sheep’s process most recently stopped existing under this daemon.
Not shep-daemon’s own ExitOutcome reused directly: that type lives
behind the spawn-runner seam (ProcessRunner::wait, in shep-daemon’s
runner module) and is free to grow with whatever the real runner needs
to observe next without dragging a breaking wire change behind it — this
one only ever grows on its own say-so. The two happen to carry the same
two fields today because the runner’s own observation IS the honest exit
outcome; shep-daemon converts one into the other at the point it records
it (Actor::handle_exited), rather than this crate depending on
shep-daemon’s internals to reuse its type.
A struct, not two flat Option<i32> fields on ProcessInfo directly:
with two flat fields, “this sheep has never exited under this daemon”
and “it exited, killed by a signal this daemon did not name” are both
all-None, and a reader cannot tell those apart. Nested behind
ProcessInfo::last_exit’s own Option, that ambiguity moves up a
level where it belongs: None there means “never exited”; Some means
“exited, and here is what this daemon knows about it” — which itself
mirrors the OS’s own exited-normally/killed-by-signal split
(WIFEXITED/WIFSIGNALED): ordinarily exactly one of code/signal is
Some. A reader must not assume both can never be None together,
though — that would still mean “this daemon recorded an exit; it could
not characterize how” rather than “this sheep never exited”, and this
type does not forbid it.
No #[non_exhaustive], unlike every other struct on this wire: those
grow because a discriminator does (ProcessInfo’s own doc lists its
four so far); code/signal is already the complete
exited-normally/killed-by-signal split the runner exposes, this crate
has no libc to derive a richer wait-status decomposition from even if it
wanted one, and there is no forecast next field. Adding the attribute
back later is a compatible change the day a real need appears (IR-16
style); carrying it now on nothing but “might grow” is the exact
speculative case IR-20 warns against.
Fields§
§code: Option<i32>The process’s own exit code, set on a normal exit (WIFEXITED).
signal: Option<i32>The raw unix signal number that ended the process, set when it did
not exit on its own (WIFSIGNALED) — an operator’s own shep stop
or shep delete included: the process still genuinely stopped by a
signal, and that stays true information even though shep, not a
crash, is what asked for it. Raw and platform-specific for the same
reason crate::signals::OperatorSignal carries no such accessor —
see that type’s own module doc — so rendering this as a name
(SIGKILL rather than 9) is a job for whichever OS-aware layer
reads it, never for this crate.
Trait Implementations§
impl Copy for ExitInfo
Source§impl<'de> Deserialize<'de> for ExitInfo
impl<'de> Deserialize<'de> for ExitInfo
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>,
impl Eq for ExitInfo
impl StructuralPartialEq for ExitInfo
Auto Trait Implementations§
impl Freeze for ExitInfo
impl RefUnwindSafe for ExitInfo
impl Send for ExitInfo
impl Sync for ExitInfo
impl Unpin for ExitInfo
impl UnsafeUnpin for ExitInfo
impl UnwindSafe for ExitInfo
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.