From a869290056645880e39fcc9f663e116d5e0b6717 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 9 Mar 2022 15:54:22 -0800 Subject: exit_handler: Alert if an unhandled error (set -e) is seen. Issue #985 --- src/share/poudriere/common.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index 8590448b..242e9c5b 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -1280,10 +1280,12 @@ sig_handler() { } exit_handler() { + exit_status="$?" case "${SHFLAGS}" in *x*) ;; *) local -; set +x ;; esac + # Ignore errors while cleaning up set +e ERRORS_ARE_FATAL=0 @@ -1321,6 +1323,9 @@ exit_handler() { cd "${MASTER_DATADIR}" fi fi + if [ "${exit_status}" -ne 0 ] && [ "${CRASHED:-0}" -eq 0 ]; then + echo "[ERROR] Unhandled error! Exiting ${exit_status}" >&2 + fi if was_a_jail_run; then # Don't use jail for any caching in cleanup SHASH_VAR_PATH="${SHASH_VAR_PATH_DEFAULT}" -- cgit v1.2.3