Skip to main content

ProcessControl

Struct ProcessControl 

Source
pub struct ProcessControl { /* private fields */ }
Expand description

Cloneable interrupt control for exactly one ProcessSubscription run.

Keep the handle in the model, rebuilding subscriptions with clones. Tag process messages with generation to reject delayed messages after a restart. Use a fresh handle for each new run. Dropping a descriptor or a handle clone does not close an active run.

Requests never wait for child I/O or model/stdin queue capacity. The owning supervisor sends SIGINT to the immediate child on Unix, without a shell or process-group signal. Linux requires a retained pidfd; if unavailable, delivery fails instead of falling back to a potentially reused PID. Other Unix platforms require the supervisor to remain the child’s sole reaper. A ProcessSubscription::pty run is the exception: SIGINT goes to the child’s whole process group, as Ctrl-C does in a terminal, and request_resize resizes its PTY.

Implementations§

Source§

impl ProcessControl

Source

pub fn new() -> Self

Create control for a future process run.

Source

pub const fn generation(&self) -> u64

Stable identity shared by clones; fresh handles have distinct identities.

Source

pub fn status(&self) -> ProcessControlStatus

Read one consistent snapshot. A closed handle need not mean output drained.

Source

pub fn request_interrupt(&self) -> Result<(), ProcessControlError>

Admit one interrupt for the supervisor to deliver.

Admission is not delivery. Read status for the outcome; even Sent does not imply that a child handler ran or the child exited.

Source

pub fn request_resize( &self, cols: u16, rows: u16, ) -> Result<(), ProcessControlError>

Ask the supervisor to resize this run’s PTY to cols x rows cells.

The latest request replaces a pending one. A request made before the child spawns sets its initial size. Otherwise the supervisor applies it within one 50 ms poll, then sends SIGWINCH to the child’s process group. Zero dimensions become one. Runs without ProcessSubscription::pty ignore resizes, and admission does not report whether one was applied.

Source

pub fn pending_resize(&self) -> Option<(u16, u16)>

The (cols, rows) a request_resize has yet to apply, if any: before spawn, the size the PTY will start at.

Trait Implementations§

Source§

impl Clone for ProcessControl

Source§

fn clone(&self) -> Self

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 ProcessControl

Source§

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

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

impl Default for ProcessControl

Source§

fn default() -> Self

Returns the “default value” for a type. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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