Skip to main content

ContainedProcessGroup

Struct ContainedProcessGroup 

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

A group of processes that are killed together when the group is dropped.

On Windows this wraps a Job Object; on Unix it tracks a process-group ID and sends SIGKILL to the group on drop.

Implementations§

Source§

impl ContainedProcessGroup

Source

pub fn new() -> Result<Self, Error>

Create a new process group without an originator.

Source

pub fn with_originator(originator: &str) -> Result<Self, Error>

Create a new process group with an originator name.

Source

pub fn originator(&self) -> Option<&str>

Returns the originator name, if set.

Source

pub fn originator_value(&self) -> Option<String>

Returns the full originator env var value (TOOL:PID), if set.

Source

pub fn spawn(&self, command: &mut Command) -> Result<ContainedChild, Error>

Spawn a contained child process. The child will be killed when this group is dropped.

Source

pub fn spawn_detached( &self, command: &mut Command, ) -> Result<ContainedChild, Error>

Spawn a detached child process. The child will survive this group being dropped.

Source

pub fn spawn_with_containment( &self, command: &mut Command, containment: Containment, ) -> Result<ContainedChild, Error>

Spawn a child process with the given containment policy.

Trait Implementations§

Source§

impl Drop for ContainedProcessGroup

Available on Unix only.
Source§

fn drop(&mut self)

Executes the destructor for this 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<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.