pub struct Chain { /* private fields */ }
Expand description
Represents a pipe chain.
Implementations
sourceimpl Chain
impl Chain
sourcepub fn kill_all(&mut self, sig: c_int) -> Result<(), KillError>
pub fn kill_all(&mut self, sig: c_int) -> Result<(), KillError>
Send signal sig
to all child processes.
sourcepub fn new(pipes: Vec<Command>) -> Result<Self>
pub fn new(pipes: Vec<Command>) -> Result<Self>
Create a new pipe chain. This function is called by the ubend!() macro.
sourcepub fn stdin(&mut self) -> Option<File>
pub fn stdin(&mut self) -> Option<File>
Take ownership of stdin of the first process in the chain.
If the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
sourcepub fn stdout(&mut self) -> Option<File>
pub fn stdout(&mut self) -> Option<File>
Take ownership of stdout of the last process in the chain.
If the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
sourcepub fn stderr(&mut self) -> Option<File>
pub fn stderr(&mut self) -> Option<File>
Take ownership of stderr of the last process in the chain.
If the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
sourcepub fn stdin_at(&mut self, index: usize) -> Option<File>
pub fn stdin_at(&mut self, index: usize) -> Option<File>
Take ownership of stdin of the process at index in the chain.
If the index is out of bounds or the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
sourcepub fn stdout_at(&mut self, index: usize) -> Option<File>
pub fn stdout_at(&mut self, index: usize) -> Option<File>
Take ownership of stdout of the process at index in the chain.
If the index is out of bounds or the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
sourcepub fn stderr_at(&mut self, index: usize) -> Option<File>
pub fn stderr_at(&mut self, index: usize) -> Option<File>
Take ownership of stderr of the process at index in the chain.
If the index is out of bounds or the setup didn’t create a pipe at the given location or the pipe was already taken this function returns None.
pub fn children(&self) -> &[Child]
pub fn children_mut(&mut self) -> &mut [Child]
sourcepub fn wait_all(&mut self) -> Vec<WaitResult>
pub fn wait_all(&mut self) -> Vec<WaitResult>
Wait for all child processes to finish.
sourcepub fn wait_last(&mut self) -> WaitResult
pub fn wait_last(&mut self) -> WaitResult
Wait for the last child process to finish.
sourcepub fn output(self) -> Result<Output, OutputError>
pub fn output(self) -> Result<Output, OutputError>
Close stdin of the first child process and read stdout and stderr of the last child process (if possible) and wait for the last child process to finish.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more