janet-lang / janet

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

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

Closed llmII closed 9 months ago

llmII commented 9 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.