X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fproc.cpp;fp=src%2Fapp%2Fproc.cpp;h=add16d1787a4779068b6ce36b06be9c9d1d9e194;hb=fab49d91255ef7d265817213c3da7e5f81df97a0;hp=c219c723effe3050b3e5c52221ce497a88f15610;hpb=c0a5ece0f6bacea1b85157a908d710070fb0affd;p=blank.git diff --git a/src/app/proc.cpp b/src/app/proc.cpp index c219c72..add16d1 100644 --- a/src/app/proc.cpp +++ b/src/app/proc.cpp @@ -311,11 +311,20 @@ int Process::Impl::Join() { if (result == -1) { throw SysError("error waiting on child process"); } - if (result == pid && WIFEXITED(status)) { + if (result != pid) { + // should in theory only happen with WNOHANG set + continue; + } + if (WIFEXITED(status)) { + // autonomous termination return WEXITSTATUS(status); } - // otherwise, child probably signalled, which we don't care - // about (please don't tell youth welfare), so try again + if (WIFSIGNALED(status)) { + // signalled termination + return WTERMSIG(status); + } + // otherwise, child probably signalled stop/continue, which we + // don't care about (please don't tell youth welfare), so try again } #endif }