summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDavid Scholberg <recombinant.vector@gmail.com>2026-01-20 00:26:44 -0500
committerDavid Scholberg <recombinant.vector@gmail.com>2026-01-20 00:26:44 -0500
commita543c00183e4315b50728b6073310bff944d8517 (patch)
tree4275c957e5e8399a7d33b84f19a9f4f5a30729a7 /src/main.c
parentbdf22227d8b822b6ef8cdc4c0a62c37018bcc415 (diff)
propagate return code when using zc `run` subcommand on POSIX
On POSIX systems, the return value of the system function from stdlib is a packed value, and requires the WEXITSTATUS macro to unpack the return code of the program that the system function ran.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 44cf45d..6fa8809 100644
--- a/src/main.c
+++ b/src/main.c
@@ -356,7 +356,11 @@ int main(int argc, char **argv)
remove(outfile);
zptr_plugin_mgr_cleanup();
zen_trigger_global();
+#if defined(WIFEXITED) && defined(WEXITSTATUS)
+ return WIFEXITED(ret) ? WEXITSTATUS(ret) : ret;
+#else
return ret;
+#endif
}
zptr_plugin_mgr_cleanup();