Use WIFEXITED() and WEXITSTATUS() on Unix system() exit code

(ensures Odin run returns correct exit code of built executable)
Adds test "tests/core/os/test_core_os_exit.odin" (Unix only)
This commit is contained in:
gitlost
2022-03-24 19:31:46 +00:00
parent a2ad16b609
commit 8661457512
3 changed files with 17 additions and 1 deletions
+10
View File
@@ -0,0 +1,10 @@
// Tests that Odin run returns exit code of built executable on Unix
// Needs exit status to be inverted to return 0 on success, e.g.
// $(./odin run tests/core/os/test_core_os_exit.odin && exit 1 || exit 0)
package test_core_os_exit
import "core:os"
main :: proc() {
os.exit(1)
}