aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlendi <slendi@socopon.com>2024-01-13 19:49:20 +0200
committerSlendi <slendi@socopon.com>2024-01-13 19:49:20 +0200
commit7826c06f61682fa3dbd02e934803bacc67e87fba (patch)
tree2c8a7a26340cda795809eb874e97b4347412dd94
parent37290711cce69cfaa36299e8a73345b018413855 (diff)
If the compiler fails, fail the rest of the build.
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r--cbuild_impl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/cbuild_impl.c b/cbuild_impl.c
index 67e92f4..be8385e 100644
--- a/cbuild_impl.c
+++ b/cbuild_impl.c
@@ -193,6 +193,10 @@ void build(project_t build) {
break;
}
}
+ if (WEXITSTATUS(status) != 0) {
+ fprintf(stderr, "\n\033[31mFailed to compile\033[0m\n");
+ exit(1);
+ }
processes_alive--;
for (size_t j = 0; j < processes_alive; j++) {
if (process_pool[j] == pid_dead) {
@@ -229,6 +233,10 @@ void build(project_t build) {
break;
}
}
+ if (WEXITSTATUS(status) != 0) {
+ fprintf(stderr, "\n\033[31mFailed to compile\033[0m\n");
+ exit(1);
+ }
processes_alive--;
for (size_t j = 0; j < processes_alive; j++) {
if (process_pool[j] == pid_dead) {
@@ -240,8 +248,14 @@ void build(project_t build) {
}
}
- for (int j = 0; j < processing_units; j++)
- waitpid(-1, NULL, 0);
+ int status;
+ for (int j = 0; j < processing_units; j++) {
+ waitpid(-1, &status, 0);
+ if (WEXITSTATUS(status) != 0) {
+ fprintf(stderr, "\n\033[31mFailed to compile\033[0m\n");
+ exit(1);
+ }
+ }
fprintf(stderr, "\33[2K\r(%ld/%ld) Linking \33[1m%s\33[0m", count++,
count_operations, exe->header.name);