pub struct ManagedProcess { /* private fields */ }Expand description
Full process lifecycle driven by a caller-owned reactor.
ManagedProcess preserves the blocking spawn semantics while allowing
an application reactor to stay responsive: Core owns timeout/cancellation
escalation, process-group signaling, pipe draining, overflow reporting, and
waitpid reaping; the caller only routes readiness events and polls on
Self::next_deadline.
Implementations§
Source§impl ManagedProcess
impl ManagedProcess
Sourcepub fn register_with_reactor(
&mut self,
reactor: &mut Reactor,
) -> Result<(), CoreError>
pub fn register_with_reactor( &mut self, reactor: &mut Reactor, ) -> Result<(), CoreError>
Register active child I/O descriptors with the caller’s reactor.
Sourcepub fn handle_reactor_event(
&mut self,
reactor: &mut Reactor,
event: &Event,
) -> Result<(), CoreError>
pub fn handle_reactor_event( &mut self, reactor: &mut Reactor, event: &Event, ) -> Result<(), CoreError>
Route one reactor event to the child’s I/O drain state.
Sourcepub fn request_cancel(&mut self)
pub fn request_cancel(&mut self)
Request cancellation using the daemon-owned policy from
SpawnOptionsBuilder::cancel. Repeated requests are idempotent.
Sourcepub fn next_deadline(&self) -> Option<Instant>
pub fn next_deadline(&self) -> Option<Instant>
Earliest time at which Self::poll_completion should run again.
A bounded reap tick is returned while the child is live, and exact
timeout / TERM-to-KILL deadlines take precedence. None means the
completion was already consumed.
Sourcepub fn poll_completion(
&mut self,
reactor: &mut Reactor,
) -> Result<Option<Output>, CoreError>
pub fn poll_completion( &mut self, reactor: &mut Reactor, ) -> Result<Option<Output>, CoreError>
Advance timeout/cancellation, reap state, and completion.
Returns Ok(None) while work remains, the normal Output once the
child is reaped and its pipes are drained, or EOVERFLOW when the
configured combined output limit was exceeded.