#[non_exhaustive]pub enum ProcessEvent {
Started {
pid: Option<u32>,
},
Stdout(OutputLine),
Stderr(OutputLine),
Exited(Outcome),
}Expand description
One lifecycle/progress event from a streamed CLI operation.
Re-exported from processkit so wrapper users do not need a second direct
dependency merely to inspect progress. The stream starts with
ProcessEvent::Started, carries stdout/stderr lines, and ends with
ProcessEvent::Exited. The enum is non-exhaustive; consumers should keep a
wildcard match arm.
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_signal →
grace_started → drained / 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
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
impl ProcessEvent
Sourcepub fn name(&self) -> &'static str
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.
Trait Implementations§
Source§impl Clone for ProcessEvent
impl Clone for ProcessEvent
Source§fn clone(&self) -> ProcessEvent
fn clone(&self) -> ProcessEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more