Struct anyhow_std::process::Child

source ·
pub struct Child {
    pub stdin: Option<ChildStdin>,
    pub stdout: Option<ChildStdout>,
    pub stderr: Option<ChildStderr>,
    /* private fields */
}
Expand description

Wrap std::process::Child to provide the command as error context

Fields§

§stdin: Option<ChildStdin>§stdout: Option<ChildStdout>§stderr: Option<ChildStderr>

Implementations§

source§

impl Child

source

pub fn kill(&mut self) -> Result<()>

Override std::process::Child::kill with the command as error context

source

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

Override std::process::Child::wait with the command as error context

source

pub fn try_wait(&mut self) -> Result<Option<ExitStatus>>

Override std::process::Child::try_wait with the command as error context

source

pub fn wait_with_output(self) -> Result<Output>

Override std::process::Child::wait_with_output with the command as error context

Methods from Deref<Target = Child>§

1.3.0 · source

pub fn id(&self) -> u32

Returns the OS-assigned process identifier associated with this child.

Examples

Basic usage:

use std::process::Command;

let mut command = Command::new("ls");
if let Ok(child) = command.spawn() {
    println!("Child's ID is {}", child.id());
} else {
    println!("ls command didn't start");
}

Trait Implementations§

source§

impl Debug for Child

source§

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

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

impl Deref for Child

§

type Target = Child

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl From<(Child, String)> for Child

source§

fn from((child, cmddesc): (Child, String)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl RefUnwindSafe for Child

§

impl Send for Child

§

impl Sync for Child

§

impl Unpin for Child

§

impl UnwindSafe for Child

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.