tokio_process_tools

Struct ProcessHandle

Source
pub struct ProcessHandle { /* private fields */ }

Implementations§

Source§

impl ProcessHandle

Source

pub fn spawn(name: impl Into<Cow<'static, str>>, cmd: Command) -> Result<Self>

Source

pub fn spawn_with_capacity( name: impl Into<Cow<'static, str>>, cmd: Command, stdout_channel_capacity: usize, stderr_channel_capacity: usize, ) -> Result<Self>

Source

pub fn id(&self) -> Option<u32>

Source

pub fn is_running(&mut self) -> IsRunning

Source

pub fn stdout(&self) -> &OutputStream

Source

pub fn stderr(&self) -> &OutputStream

Source

pub async fn wait(&mut self) -> Result<ExitStatus>

Source

pub async fn wait_with_output( &mut self, ) -> Result<(ExitStatus, Vec<String>, Vec<String>), WaitError>

Source

pub fn terminate_on_drop( self, graceful_termination_timeout: Duration, forceful_termination_timeout: Duration, ) -> TerminateOnDrop

Source

pub async fn send_interrupt_signal(&mut self) -> Result<(), Error>

Manually sed a SIGINT on unix or equivalent on Windows to this process.

Prefer to call terminate instead, if you want to make sure this process is terminated.

Source

pub async fn send_terminate_signal(&mut self) -> Result<(), Error>

Manually sed a SIGTERM on unix or equivalent on Windows to this process.

Prefer to call terminate instead, if you want to make sure this process is terminated.

Source

pub async fn terminate( &mut self, interrupt_timeout: Duration, terminate_timeout: Duration, ) -> Result<ExitStatus, TerminationError>

Terminates this process by sending a SIGINT, SIGTERM or even a SIGKILL if the process doesn’t run to completion after receiving any of the first two signals.

Recommendation: Use timeout!

Source

pub fn into_inner(self) -> (Child, OutputStream, OutputStream)

Consumes this handle to provide the wrapped tokio::process::Child instance as well as the stdout and stderr output streams.

Trait Implementations§

Source§

impl Debug for ProcessHandle

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> 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
Source§

impl<T> Sink for T
where T: Debug + Send + Sync + 'static,