From 1d4d1e9a9c023a986085b54954c1458fbd05ee2c Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 11 Jul 2026 16:02:52 +0400 Subject: [PATCH] flush or a tree of TMP_ERROR might be useful --- bin/bash-back | 11 +++++++++-- lib/utility.bash | 2 +- useless.sh | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/bash-back b/bin/bash-back index 8c8b8ac..beb281c 100755 --- a/bin/bash-back +++ b/bin/bash-back @@ -78,8 +78,15 @@ function on_exit { stack_summary+=("ERROR $code: [$message]") fi else - # FIXME: should grab the whole stacktrace, then print back again, - # because previous stderr might disappear from the first script after calling subprocess! + # FIXME: should either + # 1. grab the whole stacktrace, then print back again + # 2. or FLUSH previous stderr + # because previous stderr might disappear from the first script when calling subprocess! + # + # ```bash + # >&2 echo some trace in stderr + # lib/utility.bash # which contains error + # ``` regex="^ .*:[0-9]* .*\$" [[ "$last_error" =~ $regex ]] || stack_summary+=("ERROR $code: ") fi diff --git a/lib/utility.bash b/lib/utility.bash index 3be360e..2dc7102 100755 --- a/lib/utility.bash +++ b/lib/utility.bash @@ -8,12 +8,12 @@ function blabla { } function suite { + echo $nope return exit command_not_found exit 10 # youpi return 7 - echo $nope } blabla diff --git a/useless.sh b/useless.sh index 1cfdf49..67eda1b 100755 --- a/useless.sh +++ b/useless.sh @@ -32,8 +32,8 @@ function F3 { echo start of useless F3 >&2 echo some trace in stderr -. lib/utility.bash lib/utility.bash +. lib/utility.bash main # error