From 773ae42241497234f5c412971c8e040207f2bf6a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 11:16:01 +0200 Subject: [PATCH] test --- misc/core.func | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/misc/core.func b/misc/core.func index e3c9d265..b614fb15 100644 --- a/misc/core.func +++ b/misc/core.func @@ -193,26 +193,20 @@ SILENT_LOGFILE="/tmp/silent.$$.log" silent() { local cmd="$*" + local caller_line="${BASH_LINENO[0]:-unknown}" # Capture the line where silent was called + set +Eeuo pipefail "$@" >>"$SILENT_LOGFILE" 2>&1 local rc=$? set -Eeuo pipefail if [[ $rc -ne 0 ]]; then - local explanation - explanation="$(explain_exit_code "$rc")" - - printf "\e[?25h" - echo -e "\n${RD}[ERROR]${CL}: exit code ${RD}${rc}${CL} (${explanation}): while executing command ${YW}${cmd}${CL}\n" - - if [[ -s "$SILENT_LOGFILE" ]]; then - echo "--- Last 20 lines of silent log ($SILENT_LOGFILE) ---" - tail -n 20 "$SILENT_LOGFILE" - echo "---------------------------------------------------" - fi - - exit "$rc" + # Call error_handler with proper line number context + BASH_LINENO[0]=$caller_line # Set the line number for error_handler + error_handler "$rc" "$cmd" fi + + return $rc } # Check if the shell is using bash