summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-12 15:15:38 +0300
committerPaul Buetow <paul@buetow.org>2026-06-12 15:15:38 +0300
commit81a3be6379198c697de2f8639dcaa1cdc9d66a53 (patch)
tree603b8f4f51b025f268664008b2b208a292324c68 /src
parent6aa19aa81090898c942f44677867b1abcdb06589 (diff)
Fix remaining errexit masking for bm0
Diffstat (limited to 'src')
-rw-r--r--src/lib/action.source.sh2
-rw-r--r--src/lib/album.source.sh44
-rw-r--r--src/lib/template.source.sh21
3 files changed, 52 insertions, 15 deletions
diff --git a/src/lib/action.source.sh b/src/lib/action.source.sh
index aba24a8..f3e92be 100644
--- a/src/lib/action.source.sh
+++ b/src/lib/action.source.sh
@@ -27,7 +27,7 @@ run_action_body() {
if [[ "$-" == *e* ]]; then
"$@"
else
- ( "$@" )
+ ( set -e; "$@" )
fi
}
diff --git a/src/lib/album.source.sh b/src/lib/album.source.sh
index 29eff6b..b5495f5 100644
--- a/src/lib/album.source.sh
+++ b/src/lib/album.source.sh
@@ -943,21 +943,51 @@ generate() {
}
refresh_splash() {
+ local restore_errexit=no
+ local -i status=0
local tmp_html
local tmp_path
tmp_path=$(mktemp "$DIST_DIR/.index.html.XXXXXX")
tmp_html=$(basename "$tmp_path")
- if render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html" \
- && prepare_generation_site_assets; then
- mv "$DIST_DIR/$tmp_html" "$DIST_DIR/index.html"
- log_info "Refreshed splash page $(_display_path "$DIST_DIR/index.html")"
- return
+ if [[ "$-" == *e* ]]; then
+ restore_errexit=yes
+ set +e
+ fi
+ (
+ set -e
+ render_album_splash_page 'photos' '.' 'blurs' '.' "$tmp_html"
+ )
+ status=$?
+ if [ "$restore_errexit" = yes ]; then
+ set -e
+ fi
+ if (( status != 0 )); then
+ rm -f "$DIST_DIR/$tmp_html"
+ return "$status"
+ fi
+
+ restore_errexit=no
+ if [[ "$-" == *e* ]]; then
+ restore_errexit=yes
+ set +e
+ fi
+ (
+ set -e
+ prepare_generation_site_assets
+ )
+ status=$?
+ if [ "$restore_errexit" = yes ]; then
+ set -e
+ fi
+ if (( status != 0 )); then
+ rm -f "$DIST_DIR/$tmp_html"
+ return "$status"
fi
- rm -f "$DIST_DIR/$tmp_html"
- return 1
+ mv "$DIST_DIR/$tmp_html" "$DIST_DIR/index.html"
+ log_info "Refreshed splash page $(_display_path "$DIST_DIR/index.html")"
}
dry_run() {
diff --git a/src/lib/template.source.sh b/src/lib/template.source.sh
index 58cdfa8..8ab87b2 100644
--- a/src/lib/template.source.sh
+++ b/src/lib/template.source.sh
@@ -296,6 +296,7 @@ source_template_file() {
local -r output_path="$1"; shift
local -r render_vars_name="$1"; shift
local context_file
+ local restore_errexit=no
local -i status=0
context_file=$(mktemp)
@@ -304,14 +305,20 @@ source_template_file() {
return "$status"
fi
- if {
- serialize_template_render_context "$render_vars_name" \
- &&
+ if [[ "$-" == *e* ]]; then
+ restore_errexit=yes
+ set +e
+ fi
+ (
+ set -e
+ serialize_template_render_context "$render_vars_name"
printf 'unset BASH_ENV\n'
- } > "$context_file"; then
- status=0
- else
- status=$?
+ ) > "$context_file"
+ status=$?
+ if [ "$restore_errexit" = yes ]; then
+ set -e
+ fi
+ if (( status != 0 )); then
rm -f "$context_file"
return "$status"
fi