From 077a595c3a58f4b8978a8295fb4586994355f8bd Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 25 Jul 2026 12:59:30 +0400 Subject: [PATCH] SUBSHELL_ERROR caught up --- bin/miaou-bash | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/miaou-bash b/bin/miaou-bash index a982c6e..3d888bf 100755 --- a/bin/miaou-bash +++ b/bin/miaou-bash @@ -165,13 +165,11 @@ function on_exit { miaou_debug "UNDEFINED last error=${last_error}" regex="╟─⟶" 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 failure_type='UNDEFINED' regex='^subshell term:' @@ -181,7 +179,7 @@ function on_exit { fi fi - dump_failure + dump_failure "${last_trim:-true}" else dump_success fi @@ -240,7 +238,7 @@ function ansi_traces { } function dump_failure { 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:-} ---" if [[ ${failure_type} == 'SUBSHELL SOURCE NOT FOUND' ]]; then