summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe M <chloe@faracom.org>2026-08-16 18:01:23 -0500
committerChloe M <chloe@faracom.org>2026-08-16 18:04:14 -0500
commit4d747ebde6542a2f77ebb5f00237970b74228b5e (patch)
tree1fd49f288fa56b460540d9b69870ba50cbb21b26
parentc846f4140c2b717487c3588279ba4c2816f21487 (diff)
core: bop+hook: Handle errors within hooks
Signed-off-by: Chloe M <chloe@faracom.org>
-rw-r--r--core/bop.c10
-rw-r--r--core/hook.c8
2 files changed, 13 insertions, 5 deletions
diff --git a/core/bop.c b/core/bop.c
index f495649..e144bb2 100644
--- a/core/bop.c
+++ b/core/bop.c
@@ -68,7 +68,7 @@ static int
run_build(const char *build_dir, build_op_t bop)
{
char pathbuf[256];
- int error;
+ int error = 0;
/*
* There is a pre-build hook to be located within the [BUILD_DIR]/.bop/prehook.sh which
@@ -78,7 +78,9 @@ run_build(const char *build_dir, build_op_t bop)
if (bop != BUILD_OP_CLEAN) {
snprintf(pathbuf, sizeof(pathbuf), "%s/.bop/prehook.sh", build_dir);
if (access(pathbuf, F_OK) == 0)
- bop_shell_hook(pathbuf);
+ error = bop_shell_hook(pathbuf);
+ if (error != 0)
+ return error;
}
error = bop_build_dir(build_dir, bop);
@@ -91,7 +93,9 @@ run_build(const char *build_dir, build_op_t bop)
if (bop != BUILD_OP_CLEAN) {
snprintf(pathbuf, sizeof(pathbuf), "%s/.bop/posthook.sh", build_dir);
if (access(pathbuf, F_OK) == 0)
- bop_shell_hook(pathbuf);
+ error = bop_shell_hook(pathbuf);
+ if (error != 0)
+ return error;
}
return 0;
diff --git a/core/hook.c b/core/hook.c
index b2f3a2e..9e90b2b 100644
--- a/core/hook.c
+++ b/core/hook.c
@@ -49,7 +49,7 @@ int
bop_shell_hook(const char *hook_path)
{
pid_t child;
- int status;
+ int status = 0;
if (hook_path == NULL) {
return -1;
@@ -62,5 +62,9 @@ bop_shell_hook(const char *hook_path)
waitpid(child, &status, 0);
}
- return 0;
+ if (status != 0) {
+ printf("error: failure in '%s'\n", hook_path);
+ }
+
+ return status;
}