pub fn waitpid(
pid: Option<Pid>,
waitopts: WaitOptions,
) -> Result<Option<(Pid, WaitStatus)>>
Available on crate feature
process
only.Expand description
waitpid(pid, waitopts)
—Wait for a specific process to change state.
If the pid is None
, the call will wait for any child process whose
process group id matches that of the calling process. Otherwise, the call
will wait for the child process with the given pid.
On Success, returns the status of the selected process.
If NOHANG
was specified in the options, and the selected child process
didn’t change state, returns None
.
To wait for a given process group (the < -1
case of waitpid
), use
waitpgid
or waitid
. To wait for any process (the -1
case of
waitpid
), use wait
.