diff options
| author | gitlost <burmartke@gmail.com> | 2022-03-24 19:31:46 +0000 |
|---|---|---|
| committer | gitlost <burmartke@gmail.com> | 2022-03-24 19:31:46 +0000 |
| commit | 86614575126265a17e4a232522b7c08541375b76 (patch) | |
| tree | 4a4ae36e4d7ef2583258e41fc5776f054db5704a /src | |
| parent | a2ad16b609ddb86c410569a6786618173f58257e (diff) | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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) { |