Skip to main content

ProcessEvent

Enum ProcessEvent 

Source
#[non_exhaustive]
pub enum ProcessEvent { Started { pid: Option<u32>, }, Stdout(OutputLine), Stderr(OutputLine), Exited(Outcome), }
Expand description

A lifecycle event produced by a running child process, yielded by RunningProcess::events, which merges the process’s lifecycle transitions and its two output streams into a single ordered sequence:

Started → interleaved Stdout / Stderr lines → Exited.

This is the crate’s one asynchronous source of process events: a TUI, dashboard, or orchestrator gets started, every output line, and the final exit outcome from one stream instead of stitching them together from separate channels.

§Scope

This enum currently carries Started, the output lines, and Exited — the facts the running layer observes directly. It deliberately does not (yet) carry the graceful-teardown transitions (soft_signalgrace_starteddrained / escalated / spared): with no per-call programmatic consumer, threading a live sink for them through the teardown backends would be blast radius in concurrency-sensitive code for a speculative surface. Those live facts remain available on the tracing seam, and as a typed value after the fact via ShutdownReport. Because this enum is #[non_exhaustive], those phases (and any other kind) can be added here additively later, once a consumer needs them, without a breaking change.

#[non_exhaustive]: a future release may add another kind of event without a breaking change, so a match on ProcessEvent needs a _ arm. Each per-stream line is an OutputLine (rather than a bare String) so per-line metadata can be attached there without a breaking change either.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Started

The process has started — the first event of the stream, emitted as soon as the pid is known, before any output line. pid is None for a scripted double (which owns no OS process) or a platform that could not report one.

Fields

§pid: Option<u32>

The child’s OS process id, mirroring RunningProcess::pid at spawn.

§

Stdout(OutputLine)

A line from the child’s standard output.

§

Stderr(OutputLine)

A line from the child’s standard error.

§

Exited(Outcome)

The process has exited — the last event of the stream, emitted once the child is reaped, carrying the run’s Outcome (Exited / Signalled / TimedOut) — the same value Finished::outcome reports, not a parallel type. It is delivered by the consuming finisher (finish / wait) reaping the child, so drive the stream and that finisher together (see events).

Implementations§

Source§

impl ProcessEvent

Source

pub fn name(&self) -> &'static str

A stable, snake_case identifier for this event’s kind ("started" / "stdout" / "stderr" / "exited"), by the same convention as Outcome::name — suitable as a serde tag or a log field that survives a Debug-format change.

Source

pub fn text(&self) -> Option<&str>

The decoded text of this event’s line, if it carries one. Some for Stdout/Stderr; None for the non-line lifecycle events Started/Exited. Convenience for consumers that don’t care which stream a line came from.

Trait Implementations§

Source§

impl Clone for ProcessEvent

Source§

fn clone(&self) -> ProcessEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for ProcessEvent

Source§

impl PartialEq for ProcessEvent

Source§

fn eq(&self, other: &ProcessEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProcessEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more