pub struct TimeoutCommand { /* private fields */ }
Expand description
Spawn a child process, with a maximum duration and capture its
output. See also RunningProcess
.
Implementations§
Source§impl TimeoutCommand
impl TimeoutCommand
Sourcepub fn new(max_duration: Duration) -> Self
pub fn new(max_duration: Duration) -> Self
Create a new time-limited command. The sub-process will run at
most as long as the argument specifies. See
TimeoutCommand::spawn
for actually creating the
sub-process.
Sourcepub fn feed_stdin(&mut self, data: &[u8])
pub fn feed_stdin(&mut self, data: &[u8])
Feed the sub-process the specified binary data via its
standard input. If this method is not used, the sub-process
stdin will be fed no data. The sub-process stdin always comes
from a pipe, however, so if this method is not used, the
effect is that stdin comes from /dev/null
or another empty
file.
Sourcepub fn spawn(&self, command: Command) -> Result<RunningProcess, TimeoutError>
pub fn spawn(&self, command: Command) -> Result<RunningProcess, TimeoutError>
Start a new sub-process to execute the specified command.
The caller should set up the std::process::Command
value.
This method will redirect stdin, stdout, and stderr to use
pipes.
Auto Trait Implementations§
impl Freeze for TimeoutCommand
impl RefUnwindSafe for TimeoutCommand
impl Send for TimeoutCommand
impl Sync for TimeoutCommand
impl Unpin for TimeoutCommand
impl UnwindSafe for TimeoutCommand
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