Struct command_error::ChildContext
source · pub struct ChildContext<C> { /* private fields */ }
Expand description
A Child
process combined with context about the Command
that produced it.
The context information stored in this type is used to produce diagnostics in ChildExt
.
See: OutputContext
.
Implementations§
source§impl<C> ChildContext<C>
impl<C> ChildContext<C>
sourcepub fn into_child(self) -> C
pub fn into_child(self) -> C
Get the child process.
sourcepub fn command(&self) -> &(dyn CommandDisplay + Send + Sync)
pub fn command(&self) -> &(dyn CommandDisplay + Send + Sync)
Get a reference to the command which produced this child process.
Trait Implementations§
source§impl ChildExt for ChildContext<Child>
impl ChildExt for ChildContext<Child>
source§fn output_checked_as<O, R, E>(
self,
succeeded: impl Fn(OutputContext<O>) -> Result<R, E>
) -> Result<R, E>
fn output_checked_as<O, R, E>( self, succeeded: impl Fn(OutputContext<O>) -> Result<R, E> ) -> Result<R, E>
Wait for the process to complete, capturing its output.
succeeded
is called and returned
to determine if the command succeeded. Read moresource§fn try_wait_checked_as<R, E>(
&mut self,
succeeded: impl Fn(TryWaitContext) -> Result<R, E>
) -> Result<R, E>
fn try_wait_checked_as<R, E>( &mut self, succeeded: impl Fn(TryWaitContext) -> Result<R, E> ) -> Result<R, E>
Check if the process has exited. Read more
source§fn wait_checked_as<R, E>(
&mut self,
succeeded: impl Fn(OutputContext<ExitStatus>) -> Result<R, E>
) -> Result<R, E>
fn wait_checked_as<R, E>( &mut self, succeeded: impl Fn(OutputContext<ExitStatus>) -> Result<R, E> ) -> Result<R, E>
Wait for the process to exit.
succeeded
is called and returned to determine
if the command succeeded. Read moresource§fn output_checked_with<O, E>(
self,
succeeded: impl Fn(&O) -> Result<(), Option<E>>
) -> Result<O, Self::Error>
fn output_checked_with<O, E>( self, succeeded: impl Fn(&O) -> Result<(), Option<E>> ) -> Result<O, Self::Error>
Wait for the process to complete, capturing its output.
succeeded
is called and used to
determine if the command succeeded and (optionally) to add an additional message to the error returned. Read moresource§fn output_checked(self) -> Result<Output, Self::Error>
fn output_checked(self) -> Result<Output, Self::Error>
Wait for the process to complete, capturing its output. If the command exits with a
non-zero exit code, an error is raised. Read more
source§fn output_checked_utf8(self) -> Result<Utf8Output, Self::Error>
fn output_checked_utf8(self) -> Result<Utf8Output, Self::Error>
Wait for the process to exit, capturing its output and decoding it as UTF-8. If the command
exits with a non-zero exit code, an error is raised. Read more
source§fn output_checked_with_utf8<E>(
self,
succeeded: impl Fn(&Utf8Output) -> Result<(), Option<E>>
) -> Result<Utf8Output, Self::Error>
fn output_checked_with_utf8<E>( self, succeeded: impl Fn(&Utf8Output) -> Result<(), Option<E>> ) -> Result<Utf8Output, Self::Error>
Wait for the process to exit, capturing its output and decoding it as UTF-8.
succeeded
is
called and used to determine if the command succeeded and (optionally) to add an additional
message to the error returned. Read moresource§fn try_wait_checked(&mut self) -> Result<Option<ExitStatus>, Self::Error>
fn try_wait_checked(&mut self) -> Result<Option<ExitStatus>, Self::Error>
Check if the process has exited and, if it failed, return an error. Read more
source§fn wait_checked_with<E>(
&mut self,
succeeded: impl Fn(ExitStatus) -> Result<(), Option<E>>
) -> Result<ExitStatus, Self::Error>
fn wait_checked_with<E>( &mut self, succeeded: impl Fn(ExitStatus) -> Result<(), Option<E>> ) -> Result<ExitStatus, Self::Error>
Wait for the process to exit.
succeeded
is called and used to determine
if the command succeeded and (optionally) to add an additional message to the error
returned. Read moresource§fn wait_checked(&mut self) -> Result<ExitStatus, Self::Error>
fn wait_checked(&mut self) -> Result<ExitStatus, Self::Error>
Wait for the process to exit. If the command exits with a non-zero status
code, an error is raised containing information about the command that was run. Read more
Auto Trait Implementations§
impl<C> Freeze for ChildContext<C>where
C: Freeze,
impl<C> !RefUnwindSafe for ChildContext<C>
impl<C> Send for ChildContext<C>where
C: Send,
impl<C> Sync for ChildContext<C>where
C: Sync,
impl<C> Unpin for ChildContext<C>where
C: Unpin,
impl<C> !UnwindSafe for ChildContext<C>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more