mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-29 14:21:24 -03:00
OS X EINVAL compatibility for waitpid
The return value on OS X is more along the lines of the documented waitpid behavior; EINVAL is returned if the group no longer exists.
This commit is contained in:
committed by
Kurtis Rader
parent
8e63386203
commit
628db65504
@@ -1163,7 +1163,14 @@ void exec_job(parser_t &parser, job_t *j) {
|
||||
//but we only need to call set_child_group for the first process in the group.
|
||||
//If needs_keepalive is set, this has already been called for the keepalive process
|
||||
pid_t pid_status{};
|
||||
if (waitpid(p->pid, &pid_status, WUNTRACED) == -1) {
|
||||
int result;
|
||||
while ((result = waitpid(p->pid, &pid_status, WUNTRACED)) == -1 && errno == EINTR) {
|
||||
//This could be a superfluous interrupt or Ctrl+C at the terminal
|
||||
//In all cases, it is OK to retry since the forking code above is specifically designed
|
||||
//to never, ever hang/block in a child process before the SIGSTOP call is reached.
|
||||
continue;
|
||||
}
|
||||
if (result == -1) {
|
||||
exec_error = true;
|
||||
debug(1, L"waitpid(%d) call in unblock_pid failed:!\n", p->pid);
|
||||
wperror(L"waitpid");
|
||||
|
||||
Reference in New Issue
Block a user