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