pub struct ExecResult {
pub exec_id: String,
pub phase: Phase,
pub outcome: Option<Outcome>,
pub client_deadline: Option<ClientDeadline>,
}Expand description
An exec’s phase and, once it has one, its outcome.
A thin wrapper over the daemon’s protocol::exec::PollResponse rather than a
re-modelling of it, so the two cannot disagree. What it adds is ExecResult::done,
which is the question every caller actually asks.
Fields§
§exec_id: String§phase: Phase§outcome: Option<Outcome>None while running. Present once the child has exited.
client_deadline: Option<ClientDeadline>What the client did when its own deadline expired, for a result
super::complete::CompletionPlan::drive returned after one (BIND-9, BIND-10).
None for every other result: a poll, a wait, an ack, and a run that finished in
time.
Implementations§
Source§impl ExecResult
impl ExecResult
Sourcepub fn exit_code(&self) -> Option<i32>
pub fn exit_code(&self) -> Option<i32>
The exit code, when the child exited with one rather than dying to a signal.
Sourcepub fn succeeded(&self) -> bool
pub fn succeeded(&self) -> bool
Whether the command succeeded. false for a signal death and for a still-running
exec, since neither is a success.
pub fn stdout(&self) -> &str
pub fn stderr(&self) -> &str
Sourcepub fn posix_exit_code(&self) -> Option<i32>
pub fn posix_exit_code(&self) -> Option<i32>
The exit code a POSIX shell would report for this exec (BIND-6).
- 124 when a deadline ended the command: the daemon’s own (
timed_out), the client’s kill of a live process group after its deadline, or a result synthesized because nothing came back after that kill. 124 is GNUtimeout(1)’s code, which is what harnesses built ondocker execand friends already report. - 128 + signal for any other signal death, the shell’s convention: an out-of-memory kill (SIGKILL, 137) is not a timeout.
- The exit code otherwise.
timed_out wins over an exit code on purpose. A child that traps SIGTERM and exits 0
after the deadline fired has an exit code, and reporting it would call a timed-out
command a success while Self::succeeded says it failed. crates/model/src/run.rs checks
this rule and finds that case against the “exit code first” alternative.
None only when there is nothing to report: a running exec with no client deadline.
Sourcepub fn deadline_ended(&self) -> bool
pub fn deadline_ended(&self) -> bool
Whether a deadline ended the command, which is when Self::posix_exit_code is 124
(BIND-6): the daemon’s own (timed_out), the client’s kill of a live process group
after its deadline, or a result synthesized because nothing came back after that kill.
A kill that found the group already gone doesn’t count: the command ended by itself, and its own exit status is the answer.
Sourcepub fn notes(&self) -> Vec<String>
pub fn notes(&self) -> Vec<String>
Human-readable annotations on how to read this result, one per condition (BIND-7).
For a caller that appends them to stderr without knowing the field names: truncated output, an expired daemon deadline, writers left alive past the linger deadline, and the client deadline (a kill, or a synthesized result). Empty for a clean result.
Sourcepub fn synthesized(&self) -> bool
pub fn synthesized(&self) -> bool
Whether this result was synthesized after the client deadline (BIND-10).
Trait Implementations§
Source§impl Debug for ExecResult
impl Debug for ExecResult
Source§impl From<PollResponse> for ExecResult
impl From<PollResponse> for ExecResult
Source§fn from(response: PollResponse) -> ExecResult
fn from(response: PollResponse) -> ExecResult
Auto Trait Implementations§
impl Freeze for ExecResult
impl RefUnwindSafe for ExecResult
impl Send for ExecResult
impl Sync for ExecResult
impl Unpin for ExecResult
impl UnsafeUnpin for ExecResult
impl UnwindSafe for ExecResult
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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