not yet done with subshell error

This commit is contained in:
pvincent
2026-07-25 11:32:45 +04:00
parent 90569007e9
commit cfab4506ab
3 changed files with 20 additions and 5 deletions
+5 -5
View File
@@ -161,10 +161,9 @@ function on_exit {
fi
fi
else
failure_type='UNDEFINED'
miaou_debug "last error=${last_error}"
failure_payload="${last_error}"
regex="^ .*:[0-9]* .*\$"
miaou_debug "UNDEFINED last error=${last_error}"
regex="╟─⟶"
if [[ "$last_error" =~ $regex ]]; then
if [[ "${code}" == 128 ]]; then
failure_type='SUBSHELL_SOURCE_NOT_FOUND'
@@ -174,6 +173,7 @@ function on_exit {
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:3)"
fi
else
failure_type='UNDEFINED'
regex='^subshell term:'
if [[ "$last_error" =~ $regex ]]; then
failure_type='SUBSHELL_TERM2'
@@ -229,7 +229,7 @@ function ansi_traces {
declare -n functions=$3
optional=false
for i in "${!sources[@]}"; do
FG=RED style_ansi " ╟─⟶"
FG=RED style_ansi " ╟─⟶ "
location=$(printf "%40s" "${sources[$i]}:${lines[$i]}")
is_true "$optional" &&
location=$(FG=GRAY STYLE=ITALIC style_ansi "$location") ||
@@ -297,7 +297,7 @@ BASH_ARGV0="$1" && shift # to pretend script runs by itself
# magic FD + delayed tee => /dev/fd/3 means delayed stderr, /dev/fd/4 remains original stderr
exec 3> >(tee "$MIAOU_BASH_ERROR" >/dev/null) 4>/dev/stderr
miaou_debug '---stdout---'
miaou_debug "---stdout--$$ $BASHPID $PPID--"
# shellcheck source=/dev/null
source "$BASH_ARGV0" 2>&3
dump_success