Skip to main content

RunningCommand

Struct RunningCommand 

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

Live child process with optional piped stdio.

Implementations§

Source§

impl RunningCommand

Source

pub fn from_system( child: Child, stdin: Option<ChildStdin>, stdout: Option<ChildStdout>, stderr: Option<ChildStderr>, ) -> Self

Build a handle from a spawned OS child and taken stdio pipes.

Source

pub fn from_recording( exit: CommandExit, stdout: Option<Vec<u8>>, stderr: Vec<u8>, piped_stdin: bool, ) -> Self

Build a synthetic handle for tests and custom CommandRunner implementations.

Source

pub fn stdin_mut(&mut self) -> Option<&mut dyn Write>

Writable stdin when the spec requested a pipe.

Source

pub fn close_stdin(&mut self)

Close the stdin pipe so the child sees EOF (required after writing hook/filter stdin).

Source

pub fn stdout_mut(&mut self) -> Option<&mut dyn Read>

Readable stdout when the spec requested a pipe.

Source

pub fn wait(self) -> Result<CommandExit>

Wait for the child and return its exit status.

§Errors

Returns I/O errors from Child::wait.

Source

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

Wait and collect piped stdout/stderr.

§Errors

Returns I/O errors from Child::wait_with_output.

Source

pub fn into_child(self) -> Result<Child, CommandHandleError>

Underlying OS child for long-running filters (system runner only).

§Errors

Returns CommandHandleError when the handle is not backed by a live process.

Source

pub fn into_system_parts( self, ) -> Result<(Child, Option<ChildStdin>, Option<ChildStdout>, Option<ChildStderr>), CommandHandleError>

Split into OS child and taken stdio (system runner only).

§Errors

Returns CommandHandleError when the handle is not backed by a live process.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.