From 805dbce9196ad30ea23d9d657d465f3b9e9dae65 Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 25 Jul 2026 13:04:27 +0400 Subject: [PATCH] SUBSHELL_ERROR caught up -> fd 4 --- bin/miaou-bash | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/miaou-bash b/bin/miaou-bash index 3d888bf..283cbcb 100755 --- a/bin/miaou-bash +++ b/bin/miaou-bash @@ -166,8 +166,9 @@ function on_exit { regex="╟─⟶" if [[ "$last_error" =~ $regex ]]; then last_trim=false # keep the last error for next stacktrace + error_block=false failure_type='SUBSHELL_ERROR' - >&2 echo "SUBSHELL_ERROR caught up" + >&4 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 @@ -179,7 +180,7 @@ function on_exit { fi fi - dump_failure "${last_trim:-true}" + dump_failure "${last_trim:-true}" "${error_block:-true}" else dump_success fi @@ -240,13 +241,16 @@ function dump_failure { declare -F style_ansi >/dev/null || source "$MIAOU_BASH_DIR/lib/ansi.bash" dump_stderr "${1:-true}" - miaou_debug "---error box ${failure_type:-} ---" - if [[ ${failure_type} == 'SUBSHELL SOURCE NOT FOUND' ]]; then - : - else - >&4 ansi_block_error "$failure_type" "$failure_payload" "$code" + local error_block="${2:-true}" + if is_true $error_block; then + miaou_debug "---error box ${failure_type:-} ---" + if [[ ${failure_type} == 'SUBSHELL SOURCE NOT FOUND' ]]; then + : + else + >&4 ansi_block_error "$failure_type" "$failure_payload" "$code" + fi + miaou_debug '---end of error box---' fi - miaou_debug '---end of error box---' miaou_debug '---stacktrace---' >&4 ansi_traces stack_sources stack_lines stack_functions