From 0b1de89324bd680771e2b130e0b5beda78c12e0e Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 11 Jul 2026 13:59:03 +0400 Subject: [PATCH] almost done --- bin/bash-back | 4 ++-- lib/utility.bash | 6 ++++-- useless.sh | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/bash-back b/bin/bash-back index b0186aa..e4adbb2 100755 --- a/bin/bash-back +++ b/bin/bash-back @@ -1,7 +1,7 @@ #!/usr/bin/env bash # CONSTANTS -DEBUG=true +DEBUG=${BASH_BACK_DEBUG:-false} TMP_ERROR=$(mktemp -t "$(basename $0).XXXXXXXX" --tmpdir=/run/user/$(id -u)) SCRIPT=$1 @@ -75,6 +75,7 @@ function on_exit { fi stack_summary+=("ERROR $code: [$message]") else + # TODO: if last_error is a detected stacktrace, grab as so stack_summary+=("ERROR $code: ") fi @@ -103,7 +104,6 @@ function dump_stderr { last_trim=${1:-false} mapfile -t tmp_error <$TMP_ERROR if $last_trim; then - echo "${#tmp_error[@]}" unset tmp_error[-1] tmp_error=("${tmp_error[@]}") fi diff --git a/lib/utility.bash b/lib/utility.bash index 7a92cf6..2eceef9 100755 --- a/lib/utility.bash +++ b/lib/utility.bash @@ -1,15 +1,17 @@ +#!/usr/bin/env bash-back #!/usr/bin/env bash function blabla { echo IN blabla OUT suite + echo $? } function suite { - return - return 7 command_not_found echo $nope + return + return 7 exit 10 # youpi exit } diff --git a/useless.sh b/useless.sh index adde5b1..962d88b 100755 --- a/useless.sh +++ b/useless.sh @@ -32,9 +32,9 @@ function F3 { echo start of useless F3 # lib/utility.bash -. lib/utility.bash +# . lib/utility.bash ->&2 echo some trace in stderr +# >&2 echo some trace in stderr main -error +# error echo end of useless