From 81330972640629b905fbc3d10ffc3e53361479b5 Mon Sep 17 00:00:00 2001 From: Mosder Date: Tue, 6 Oct 2026 17:56:55 +0200 Subject: changed status exit code getting to use WEXITSTATUS instead of bit shifting --- src/tester.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/tester.c') 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: "); -- cgit v1.2.3