Browse Source

almost done

main
pvincent 1 week ago
parent
commit
0b1de89324
  1. 4
      bin/bash-back
  2. 6
      lib/utility.bash
  3. 6
      useless.sh

4
bin/bash-back

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# CONSTANTS # CONSTANTS
DEBUG=true
DEBUG=${BASH_BACK_DEBUG:-false}
TMP_ERROR=$(mktemp -t "$(basename $0).XXXXXXXX" --tmpdir=/run/user/$(id -u)) TMP_ERROR=$(mktemp -t "$(basename $0).XXXXXXXX" --tmpdir=/run/user/$(id -u))
SCRIPT=$1 SCRIPT=$1
@ -75,6 +75,7 @@ function on_exit {
fi fi
stack_summary+=("ERROR $code: [$message]") stack_summary+=("ERROR $code: [$message]")
else else
# TODO: if last_error is a detected stacktrace, grab as so
stack_summary+=("ERROR $code: <undefined>") stack_summary+=("ERROR $code: <undefined>")
fi fi
@ -103,7 +104,6 @@ function dump_stderr {
last_trim=${1:-false} last_trim=${1:-false}
mapfile -t tmp_error <$TMP_ERROR mapfile -t tmp_error <$TMP_ERROR
if $last_trim; then if $last_trim; then
echo "${#tmp_error[@]}"
unset tmp_error[-1] unset tmp_error[-1]
tmp_error=("${tmp_error[@]}") tmp_error=("${tmp_error[@]}")
fi fi

6
lib/utility.bash

@ -1,15 +1,17 @@
#!/usr/bin/env bash-back
#!/usr/bin/env bash #!/usr/bin/env bash
function blabla { function blabla {
echo IN blabla OUT echo IN blabla OUT
suite suite
echo $?
} }
function suite { function suite {
return
return 7
command_not_found command_not_found
echo $nope echo $nope
return
return 7
exit 10 # youpi exit 10 # youpi
exit exit
} }

6
useless.sh

@ -32,9 +32,9 @@ function F3 {
echo start of useless echo start of useless
F3 F3
# lib/utility.bash # lib/utility.bash
. lib/utility.bash
# . lib/utility.bash
>&2 echo some trace in stderr
# >&2 echo some trace in stderr
main main
error
# error
echo end of useless echo end of useless
Loading…
Cancel
Save