Struct shared_child::SharedChild [−][src]
pub struct SharedChild { /* fields omitted */ }
Implementations
Spawn a new SharedChild
from a
std::process::Command
.
Construct a new SharedChild
from an already spawned
std::process::Child
.
This constructor needs to know whether child
has already been waited on, and the only way
to find that out is to call child.try_wait()
internally. If the child process is
currently a zombie, that call will clean it up as a side effect. The SharedChild::spawn
constructor doesn’t need to do this.
Wait for the child to exit, blocking the current thread, and return its exit status.
Return the child’s exit status if it has already exited. If the child is
still running, return Ok(None)
.
Send a kill signal to the child. On Unix this sends SIGKILL, and you
should call wait
afterwards to avoid leaving a zombie. If the process
has already been waited on, this returns Ok(())
and does nothing.
Consume the SharedChild
and return the
std::process::Child
it contains.
We never reap the child process except by calling wait
or try_wait
on it, so the child object’s inner state is correct, even if it was
waited on while it was shared.
Take the child’s
stdin
handle, if any.
This will only return Some
the first time it’s called, and then only if the Command
that created the child was configured with .stdin(Stdio::piped())
.
Take the child’s
stdout
handle, if any.
This will only return Some
the first time it’s called, and then only if the Command
that created the child was configured with .stdout(Stdio::piped())
.
Take the child’s
stderr
handle, if any.
This will only return Some
the first time it’s called, and then only if the Command
that created the child was configured with .stderr(Stdio::piped())
.