mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
Suppress spurious "killing process N: Operation not permitted" on macOS
This commit is contained in:
parent
25230a17a9
commit
177f3996e2
1 changed files with 9 additions and 2 deletions
|
@ -724,8 +724,15 @@ int Pid::kill()
|
||||||
/* Send the requested signal to the child. If it has its own
|
/* Send the requested signal to the child. If it has its own
|
||||||
process group, send the signal to every process in the child
|
process group, send the signal to every process in the child
|
||||||
process group (which hopefully includes *all* its children). */
|
process group (which hopefully includes *all* its children). */
|
||||||
if (::kill(separatePG ? -pid : pid, killSignal) != 0)
|
if (::kill(separatePG ? -pid : pid, killSignal) != 0) {
|
||||||
printError((SysError(format("killing process %1%") % pid).msg()));
|
/* On BSDs, killing a process group will return EPERM if all
|
||||||
|
processes in the group are zombies (or something like
|
||||||
|
that). So try to detect and ignore that situation. */
|
||||||
|
#if __FreeBSD__ || __APPLE__
|
||||||
|
if (errno != EPERM || ::kill(pid, 0) != 0)
|
||||||
|
#endif
|
||||||
|
printError((SysError("killing process %d", pid).msg()));
|
||||||
|
}
|
||||||
|
|
||||||
return wait();
|
return wait();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue