Skip to main content

ManagedProcess

Struct ManagedProcess 

Source
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

Source

pub fn pid(&self) -> pid_t

Return the child PID.

Source

pub fn register_with_reactor( &mut self, reactor: &mut Reactor, ) -> Result<(), CoreError>

Register active child I/O descriptors with the caller’s reactor.

Source

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.

Source

pub fn request_cancel(&mut self)

Request cancellation using the daemon-owned policy from SpawnOptionsBuilder::cancel. Repeated requests are idempotent.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for ManagedProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.