error-log
This commit is contained in:
parent
cde9ae6d4b
commit
5c750affa5
@ -202,10 +202,8 @@ silent() {
|
||||
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
BASH_COMMAND="$cmd"
|
||||
error_handler "$rc"
|
||||
return $rc
|
||||
fi
|
||||
|
||||
return $rc
|
||||
}
|
||||
|
||||
# Function to download & save header files
|
||||
|
@ -81,11 +81,13 @@ explain_exit_code() {
|
||||
|
||||
# === Error handler ============================================================
|
||||
error_handler() {
|
||||
local exit_code=$?
|
||||
local exit_code=${1:-$?}
|
||||
local line_number=${BASH_LINENO[0]:-unknown}
|
||||
local command=${BASH_COMMAND:-unknown}
|
||||
|
||||
# Exitcode 0 = kein Fehler → ignorieren
|
||||
# $STD im Kommando entfernen (nur kosmetisch)
|
||||
command=${command//\$STD /}
|
||||
|
||||
if [[ "$exit_code" -eq 0 ]]; then
|
||||
return 0
|
||||
fi
|
||||
@ -107,6 +109,13 @@ error_handler() {
|
||||
} >>"$DEBUG_LOGFILE"
|
||||
fi
|
||||
|
||||
# Silent-Log
|
||||
if [[ -n "${SILENT_LOGFILE:-}" && -s "$SILENT_LOGFILE" ]]; then
|
||||
echo "--- Last 20 lines of silent log ($SILENT_LOGFILE) ---"
|
||||
tail -n 20 "$SILENT_LOGFILE"
|
||||
echo "---------------------------------------------------"
|
||||
fi
|
||||
|
||||
exit "$exit_code"
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Author: tteck (tteckster)
|
||||
# Co-Author: MickLesk
|
||||
# Co-Author: michelroegl-brunner
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
|
||||
|
Loading…
x
Reference in New Issue
Block a user