pub struct UnixChild {
pub stdin: Option<ChildStdin>,
pub stdout: Option<ChildStdout>,
pub stderr: Option<ChildStderr>,
/* private fields */
}Expand description
A spawned Unix child. The same API as Windows’ WindowsChild: public stdio fields, id,
try_wait, wait and kill. It does not expose the std Child, because a std reap the
crate cannot see would make later group signals unsafe (see the module documentation).
Obtained through OwnedChild::child, which holds the shared
lock while the guard lives. wait through the guard therefore holds that lock until the
child has exited, and every other thread’s access to the same child (a bounded wait on a
clone, kill, terminate_tree, Drop) waits behind it, as std::process::Child::wait
through the guard did in 0.3.3. Prefer OwnedChild::wait, wait_timeout or
ProcessHandle::wait, which release the lock between looks.
Fields§
§stdin: Option<ChildStdin>§stdout: Option<ChildStdout>§stderr: Option<ChildStderr>Implementations§
Source§impl UnixChild
impl UnixChild
pub fn id(&self) -> u32
Sourcepub fn try_wait(&mut self) -> Result<Option<ExitStatus>>
pub fn try_wait(&mut self) -> Result<Option<ExitStatus>>
Non-blocking. A Some result means the leader has been reaped, and ends group
signalling for this child.
Sourcepub fn wait(&mut self) -> Result<ExitStatus>
pub fn wait(&mut self) -> Result<ExitStatus>
Closes stdin as std does, then waits until the leader is reaped. The reap itself is only
ever a non-blocking waitpid(WNOHANG) between sleeps, but this method cannot release
the lock: when it is reached through the OwnedChild::child() guard the caller holds
it for the whole wait, so other threads’ waits, kills and drops on the same child
queue behind it (as with std::process::Child::wait in 0.3.3). Use OwnedChild::wait
or ProcessHandle::wait where that matters.