Skip to main content

DetachedChild

Struct DetachedChild 

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

A minimal handle to a child spawned outside this crate’s kill-on-drop containment via Command::spawn_detached.

§Warning — this inverts the crate’s headline guarantee

Everywhere else, processkit guarantees a child — and everything it spawns — dies with its owner (kill-on-drop). A DetachedChild is the crate’s one deliberate exception: the child was launched into its own session (Unix setsid) and is not assigned to this crate’s containment (no Windows Job Object / cgroup / process-group tracking), so dropping this handle does nothing to the child — it keeps running, and its lifetime is now entirely yours to manage.

That is why this is a separate, non-interchangeable type, not a RunningProcess: it deliberately offers no kill, no wait, no timeout, no output capture, and no teardown verbs. All it carries is the child’s pid. If you need any of those, you need containment — use Command::start instead and keep the handle.

Not contained by this crate — but a host container may still bind it. spawn_detached deliberately does not break out of an external Job Object / cgroup that already contains your process (a CI runner, a systemd scope, this crate’s own supervisor); doing so would be hostile to whoever set that containment up. So a detached child escapes only this crate’s per-run containment, not a broader host one it inherits.

Implementations§

Source§

impl DetachedChild

Source

pub fn pid(&self) -> u32

The OS process id of the detached child, as reported at spawn.

Because a detached child is no longer reaped by this crate, this pid can be recycled by the OS once the child exits and is reaped elsewhere (on Unix, init reaps it after your process exits). Treat it as a spawn-time identifier, not a durable handle to a still-live process.

Trait Implementations§

Source§

impl Debug for DetachedChild

Source§

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

Formats the value using the given formatter. 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> 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 + Sync + Send>

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