From 1e6787eb30f5ceaa9c15d4982d0d131bd79392ba Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 5 Oct 2026 23:43:18 +0200 Subject: [PATCH] fix: surface podman errors instead of aborting silently `set -e` aborted build.sh when `podman image rm`/`prune` failed, and `2>/dev/null` hid the reason, so --remove exited 125 with no output. Combining --remove --prune also skipped the prune. Guard the removal with `podman image exists` for a clear "nothing to remove", drop `2>/dev/null` so podman's reason is visible, and use `cmd || echo` to warn without aborting. Exit status stays 0 on failure by design. --- build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 68793c9..a7f218e 100755 --- a/build.sh +++ b/build.sh @@ -42,10 +42,14 @@ fi if ((REMOVE || PRUNE)); then if ((REMOVE)); then - podman image rm "${IMAGE}" 2>/dev/null + if podman image exists "$IMAGE"; then + podman image rm "${IMAGE}" || echo "WARNING: could not remove $IMAGE" >&2 + else + echo "$IMAGE does not exist, nothing to remove" + fi fi if ((PRUNE)); then - podman image prune -f 2>/dev/null + podman image prune -f || echo "WARNING: prune failed" >&2 fi exit 0 fi