Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2022-05-28 02:43:35 +0300
committerBryan Drewery <bryan@shatow.net>2022-05-28 02:51:38 +0300
commit8170f398de45251a62fd7b662f294ce9c4a289c9 (patch)
tree959c60822a199deb9f044701b4c2298e37765487 /src/share
parent10867ecb1ec078b5979e0bb8d4f524397e085932 (diff)
Tweak error spam on exit to avoid false-positives.
Issue #985
Diffstat (limited to 'src/share')
-rwxr-xr-xsrc/share/poudriere/common.sh17
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
}