janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.38k stars 217 forks source link

Fix: make `proc_get_status` compliant to OS documentation. #1403

Closed llmII closed 4 months ago

llmII commented 4 months ago

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.

Also relevant is information gathered by @sogaiu in question-about-WTERMSIG-in-janet.md.

The idea here (currently, though it could be changed) is to panic when an unknown status code is encountered, as well as comply to the man 2 waitpid documentation.