1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Merge pull request #1403 from llmII/fix-os-proc-wait

Fix: make `proc_get_status` compliant to OS documentation.
This commit is contained in:
Calvin Rose 2024-02-15 04:01:09 -08:00 committed by GitHub
commit 49eb5f8563
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -505,8 +505,11 @@ static int proc_get_status(JanetProc *proc) {
status = WEXITSTATUS(status);
} else if (WIFSTOPPED(status)) {
status = WSTOPSIG(status) + 128;
} else {
} else if (WIFSIGNALED(status)){
status = WTERMSIG(status) + 128;
} else {
/* Could possibly return -1 but for now, just panic */
janet_panicf("Undefined status code for process termination, %d.", status);
}
return status;
}