SUBSHELL_ERROR caught up

This commit is contained in:
pvincent
2026-07-25 12:59:30 +04:00
parent cfab4506ab
commit 077a595c3a
+7 -9
View File
@@ -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 last_trim=false # keep the last error for next stacktrace
failure_type='SUBSHELL_SOURCE_NOT_FOUND' failure_type='SUBSHELL_ERROR'
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:2)" >&2 echo "SUBSHELL_ERROR caught up"
else stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:2)"
failure_type='SUBSHELL_ERROR' [[ "${code}" == 128 ]] && failure_type='SUBSHELL_SOURCE_NOT_FOUND'
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:3)"
fi
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