From 86614575126265a17e4a232522b7c08541375b76 Mon Sep 17 00:00:00 2001 From: gitlost Date: Thu, 24 Mar 2022 19:31:46 +0000 Subject: 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) --- src/main.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 63b2c8386..905571f44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -117,6 +117,9 @@ i32 system_exec_command_line_app(char const *name, char const *fmt, ...) { gb_printf_err("%s\n\n", cmd_line); } exit_code = system(cmd_line); + if (WIFEXITED(exit_code)) { + exit_code = WEXITSTATUS(exit_code); + } #endif if (exit_code) { -- cgit v1.2.3