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.
This commit is contained in:
Ian
2026-10-05 23:43:18 +02:00
parent 050e9c0205
commit 1e6787eb30
+6 -2
View File
@@ -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