rustix icon indicating copy to clipboard operation
rustix copied to clipboard

waitpgid discards valuable information

Open passcod opened this issue 1 year ago • 0 comments

As per its source:

pub fn waitpgid(pgid: Pid, waitopts: WaitOptions) -> Result<Option<WaitStatus>> {
    Ok(syscalls::waitpgid(pgid, waitopts)?.map(|(_, status)| status))
}

The first return value is the PID of the process that was actually awaited, which may be any process in the group. That's valuable to be able to wait for an entire process group and retrieve the exitstatus of the correct process (generally the group leader) regardless of exit order.

passcod avatar Mar 09 '24 10:03 passcod