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
# 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: <undefined>")
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

6
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
}

6
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
Loading…
Cancel
Save