forked from lix-project/nix-eval-jobs
fix exit status reporting when evaluation fails
This commit is contained in:
parent
89927c434c
commit
83df9d4e24
|
@ -109,7 +109,8 @@ void handleBrokenWorkerPipe(Proc &proc) {
|
||||||
// need to wait for it again to avoid error messages
|
// need to wait for it again to avoid error messages
|
||||||
pid_t pid = proc.pid.release();
|
pid_t pid = proc.pid.release();
|
||||||
while (1) {
|
while (1) {
|
||||||
int rc = waitpid(pid, nullptr, WNOHANG);
|
int status;
|
||||||
|
int rc = waitpid(pid, &status, WNOHANG);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
throw Error("BUG: worker pipe closed but worker still running?");
|
throw Error("BUG: worker pipe closed but worker still running?");
|
||||||
|
@ -118,16 +119,16 @@ void handleBrokenWorkerPipe(Proc &proc) {
|
||||||
throw Error("BUG: waitpid waiting for worker failed: %s",
|
throw Error("BUG: waitpid waiting for worker failed: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
if (WIFEXITED(rc)) {
|
if (WIFEXITED(status)) {
|
||||||
throw Error("evaluation worker exited with %d",
|
throw Error("evaluation worker exited with %d",
|
||||||
WEXITSTATUS(rc));
|
WEXITSTATUS(status));
|
||||||
} else if (WIFSIGNALED(rc)) {
|
} else if (WIFSIGNALED(status)) {
|
||||||
if (WTERMSIG(rc) == SIGKILL) {
|
if (WTERMSIG(status) == SIGKILL) {
|
||||||
throw Error("evaluation worker killed by SIGKILL, maybe "
|
throw Error("evaluation worker killed by SIGKILL, maybe "
|
||||||
"memory limit reached?");
|
"memory limit reached?");
|
||||||
}
|
}
|
||||||
throw Error("evaluation worker killed by signal %d",
|
throw Error("evaluation worker killed by signal %d (%s)",
|
||||||
WTERMSIG(rc));
|
WTERMSIG(status), strsignal(WTERMSIG(status)));
|
||||||
} // else ignore WIFSTOPPED and WIFCONTINUED
|
} // else ignore WIFSTOPPED and WIFCONTINUED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue