rustix::process

Function waitpid

source
pub fn waitpid(
    pid: Option<Pid>,
    waitopts: WaitOptions,
) -> Result<Option<WaitStatus>>
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.

§Bugs

This function does not currently support waiting for given process group (the < 0 case of waitpid); to do that, currently the waitpgid or waitid function must be used.

This function does not currently support waiting for any process (the -1 case of waitpid); to do that, currently the wait function must be used.

§References