mirror of
https://github.com/janet-lang/janet
synced 2024-11-18 06:34:48 +00:00
Fix: os/proc-wait
As discused over gitter, `WIFSIGNALED` macro must be checked before one uses the WTERMSIG macro. This change reflects that necessity and adds a final else clause which will panic if no status code could be determined.
This commit is contained in:
parent
431ecd3d1a
commit
7e94c091eb
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user