diff options
author | Bryan Drewery <bryan@shatow.net> | 2022-03-10 02:54:22 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2022-03-10 02:56:00 +0300 |
commit | a869290056645880e39fcc9f663e116d5e0b6717 (patch) | |
tree | 230e3049dc9541e6bab9fe900dd90699f3d9cd38 /src/share | |
parent | 912e294543f9cd140ad55dc7c9f736e3683961d4 (diff) |
exit_handler: Alert if an unhandled error (set -e) is seen.
Issue #985
Diffstat (limited to 'src/share')
-rwxr-xr-x | src/share/poudriere/common.sh | 5 |
1 files changed, 5 insertions, 0 deletions
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}" |