pub struct RunningCommand { /* private fields */ }Expand description
Live child process with optional piped stdio.
Implementations§
Source§impl RunningCommand
impl RunningCommand
Sourcepub fn from_system(
child: Child,
stdin: Option<ChildStdin>,
stdout: Option<ChildStdout>,
stderr: Option<ChildStderr>,
kill_process_group: bool,
) -> Self
pub fn from_system( child: Child, stdin: Option<ChildStdin>, stdout: Option<ChildStdout>, stderr: Option<ChildStderr>, kill_process_group: bool, ) -> Self
Build a handle from a spawned OS child and taken stdio pipes.
Sourcepub fn from_recording(
exit: CommandExit,
stdout: Option<Vec<u8>>,
stderr: Vec<u8>,
piped_stdin: bool,
) -> Self
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.
Sourcepub fn stdin_mut(&mut self) -> Option<&mut dyn Write>
pub fn stdin_mut(&mut self) -> Option<&mut dyn Write>
Writable stdin when the spec requested a pipe.
Sourcepub fn close_stdin(&mut self)
pub fn close_stdin(&mut self)
Close the stdin pipe so the child sees EOF (required after writing hook/filter stdin).
Sourcepub fn child_pid(&self) -> Option<u32>
pub fn child_pid(&self) -> Option<u32>
OS pid when this handle wraps a live child; None for synthetic recording handles.
Sourcepub fn try_wait(&mut self) -> Result<Option<CommandExit>>
pub fn try_wait(&mut self) -> Result<Option<CommandExit>>
Poll whether the child has exited without blocking.
§Errors
Returns I/O errors from Child::try_wait.
Sourcepub fn kill(&mut self) -> Result<()>
pub fn kill(&mut self) -> Result<()>
Send SIGKILL to a live child (Unix) or terminate it (Windows).
§Errors
Returns I/O errors from Child::kill.
Sourcepub fn wait(self) -> Result<CommandExit>
pub fn wait(self) -> Result<CommandExit>
Sourcepub fn wait_with_output(self) -> Result<CommandOutput>
pub fn wait_with_output(self) -> Result<CommandOutput>
Sourcepub fn into_system_parts(
self,
) -> Result<(Child, Option<ChildStdin>, Option<ChildStdout>, Option<ChildStderr>), CommandHandleError>
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§
impl Freeze for RunningCommand
impl RefUnwindSafe for RunningCommand
impl Send for RunningCommand
impl Sync for RunningCommand
impl Unpin for RunningCommand
impl UnsafeUnpin for RunningCommand
impl UnwindSafe for RunningCommand
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