Struct duct::Handle
[−]
[src]
pub struct Handle { /* fields omitted */ }A handle to a running expression, returned by the
start method. Calling start
followed by output on the handle is
equivalent to run. Note that unlike
std::process::Child,
most of the methods on Handle take &self rather than &mut self, and a
Handle may be shared between multiple threads.
Like std::process::Child, Handle does not implement Drop. If a
Handle goes out of scope without calling
wait or similar, child processes and
background threads will keep running, and they'll leave
zombies when they exit.
See the shared_child
crate for implementation details behind making handles thread safe.
Methods
impl Handle[src]
fn wait(&self) -> Result<&Output>[src]
Wait for the running expression to finish, and return a reference to its
std::process::Output.
Multiple threads may wait at the same time.
fn try_wait(&self) -> Result<Option<&Output>>[src]
Check whether the running expression is finished. If it is, return a
reference to its
std::process::Output.
If it's still running, return Ok(None).
fn output(self) -> Result<Output>[src]
Wait for the running expression to finish, and then return a
std::process::Output
object containing the results, including any captured output. This
consumes the Handle. Calling
start followed by output is
equivalent to run.
fn kill(&self) -> Result<()>[src]
Kill the running expression.