From a1d54dd8b69c1731e0bd4229a4af0d83b5e330d3 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Fri, 14 Mar 2025 10:14:17 +0330 Subject: Error checking. --- build.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'build.c') diff --git a/build.c b/build.c index e3bdb04..d9bda31 100644 --- a/build.c +++ b/build.c @@ -172,11 +172,15 @@ int system(const char *command) { return status; } -int run(const char *command) { +void run(const char *command) { staputs("> "); puts(command); staputs("\n"); - return system(command); + int status = system(command); + if (status != 0) { + staputs("** Builder encountered error. Exiting with respective code. **\n"); + exit(status); + } } __attribute__((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3))) void * @@ -320,7 +324,7 @@ void run_dep_macro(char *name) { self[ sizeof(self) - 1 ] = '\0'; run("rm -f moonshine.expander.h"); - system(self); + run(self); } unsigned char install_ran = 0; -- cgit v1.2.3