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:55:46 +0300 |
commit | b82a4af91ba57b599369a4af0ed8d9c036109fa2 (patch) | |
tree | 1c3d2d28b792195148ca49d2bedf3347bf1aa7b4 | |
parent | 6cc168dd7d1be1a2d074ff92c7abe91024775389 (diff) |
exit_handler: Alert if an unhandled error (set -e) is seen.
Issue #985
-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 cdfe8e54..39c4ac9d 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -1061,6 +1061,8 @@ sig_handler() { } exit_handler() { + exit_status="$?" + # Ignore errors while cleaning up set +e ERRORS_ARE_FATAL=0 @@ -1082,6 +1084,9 @@ exit_handler() { cd "${MASTERMNT}/.p" 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}" |