waitpid-fix #38

Merged
JakeHillion merged 2 commits from waitpid-fix into main 2022-05-19 17:28:28 +01:00
Showing only changes of commit 4f0f74b859 - Show all commits

View File

@ -17,8 +17,8 @@ use std::path::Path;
use nix::fcntl::OFlag; use nix::fcntl::OFlag;
use nix::sys::socket; use nix::sys::socket;
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; use nix::sys::wait::{waitid, Id, WaitPidFlag, WaitStatus};
use nix::unistd::{self, Pid}; use nix::unistd;
pub struct RunArgs<'a> { pub struct RunArgs<'a> {
pub spec: Option<&'a Path>, pub spec: Option<&'a Path>,
@ -72,7 +72,7 @@ pub fn run(args: &RunArgs) -> Result<i32> {
let mut exit_code = exitcode::OK; let mut exit_code = exitcode::OK;
loop { loop {
let status = match waitpid(Some(Pid::from_raw(-1)), Some(WaitPidFlag::WEXITED)) { let status = match waitid(Id::All, WaitPidFlag::WEXITED) {
Ok(v) => Ok(v), Ok(v) => Ok(v),
Err(nix::Error::ECHILD) => { Err(nix::Error::ECHILD) => {
info!("all child processes have exited, exiting..."); info!("all child processes have exited, exiting...");