Browse Source

SUBSHELL_ERROR caught up

main
pvincent 14 hours ago
parent
commit
077a595c3a
  1. 16
      bin/miaou-bash

16
bin/miaou-bash

@ -165,13 +165,11 @@ function on_exit {
miaou_debug "UNDEFINED last error=${last_error}" miaou_debug "UNDEFINED last error=${last_error}"
regex="╟─⟶" regex="╟─⟶"
if [[ "$last_error" =~ $regex ]]; then if [[ "$last_error" =~ $regex ]]; then
if [[ "${code}" == 128 ]]; then
failure_type='SUBSHELL_SOURCE_NOT_FOUND'
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:2)"
else
failure_type='SUBSHELL_ERROR'
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:3)"
fi
last_trim=false # keep the last error for next stacktrace
failure_type='SUBSHELL_ERROR'
>&2 echo "SUBSHELL_ERROR caught up"
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:2)"
[[ "${code}" == 128 ]] && failure_type='SUBSHELL_SOURCE_NOT_FOUND'
else else
failure_type='UNDEFINED' failure_type='UNDEFINED'
regex='^subshell term:' regex='^subshell term:'
@ -181,7 +179,7 @@ function on_exit {
fi fi
fi fi
dump_failure
dump_failure "${last_trim:-true}"
else else
dump_success dump_success
fi fi
@ -240,7 +238,7 @@ function ansi_traces {
} }
function dump_failure { function dump_failure {
declare -F style_ansi >/dev/null || source "$MIAOU_BASH_DIR/lib/ansi.bash" declare -F style_ansi >/dev/null || source "$MIAOU_BASH_DIR/lib/ansi.bash"
dump_stderr true
dump_stderr "${1:-true}"
miaou_debug "---error box ${failure_type:-} ---" miaou_debug "---error box ${failure_type:-} ---"
if [[ ${failure_type} == 'SUBSHELL SOURCE NOT FOUND' ]]; then if [[ ${failure_type} == 'SUBSHELL SOURCE NOT FOUND' ]]; then

Loading…
Cancel
Save