diff options
| author | Mosder <git@mosder.eu> | 2026-10-06 17:56:55 +0200 |
|---|---|---|
| committer | Mosder <git@mosder.eu> | 2026-10-06 17:56:55 +0200 |
| commit | 81330972640629b905fbc3d10ffc3e53361479b5 (patch) | |
| tree | 65270f3da3b196e11d3402a04d2b979644f1e2a7 /src/tester.c | |
| parent | 4513d3c2733e63659320a0b4e23af9bdb72440b6 (diff) | |
changed status exit code getting to use WEXITSTATUS instead of bit shifting
Diffstat (limited to 'src/tester.c')
| -rw-r--r-- | src/tester.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tester.c b/src/tester.c index 70e0d24..becc659 100644 --- a/src/tester.c +++ b/src/tester.c @@ -122,13 +122,18 @@ void mos_test_assert_exit_fn(MosTestFn function, int code, const char *name) { int status; waitpid(pid, &status, 0); - int exit_code = status >> 8; uint8_t exited = 1; close(fd[1]); read(fd[0], &exited, sizeof(uint8_t)); close(fd[0]); + int exit_code = 0; + if (WIFEXITED(status)) + exit_code = WEXITSTATUS(status); + else + exited = 0; + if (!exited) { failed = 1; print_color(RED, "ASSERT FAILED: "); |
