diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/share/poudriere/common.sh | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index fe834720..27286c70 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -1285,7 +1285,11 @@ exit_handler() { *x*) ;; *) local -; set +x ;; esac - + # Don't spam errors with 'set +e; exit >0'. + case "$-" in + *e*) ;; + *) ERROR_VERBOSE=0 ;; + esac # Ignore errors while cleaning up set +e ERRORS_ARE_FATAL=0 @@ -1323,9 +1327,16 @@ exit_handler() { cd "${MASTER_DATADIR}" fi fi - if [ "${exit_status}" -ne 0 ] && [ "${CRASHED:-0}" -eq 0 ]; then + + case "${exit_status}" in + 0|${EX_USAGE}) + : ${ERROR_VERBOSE:=0} ;; + *) : ${ERROR_VERBOSE:=1} ;; + esac + if [ "${ERROR_VERBOSE}" -eq 1 ] && [ "${CRASHED:-0}" -eq 0 ]; then echo "[ERROR] Unhandled error!" >&2 fi + if was_a_jail_run; then # Don't use jail for any caching in cleanup SHASH_VAR_PATH="${SHASH_VAR_PATH_DEFAULT}" @@ -1364,7 +1375,7 @@ exit_handler() { if [ -n "${POUDRIERE_TMPDIR-}" ]; then rm -rf "${POUDRIERE_TMPDIR}" >/dev/null 2>&1 || : fi - if [ "${exit_status}" -ne 0 ]; then + if [ "${ERROR_VERBOSE}" -eq 1 ]; then echo "Exiting with status ${exit_status}" >&2 || : fi } |