not yet done with subshell error
This commit is contained in:
+4
-4
@@ -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'
|
||||
@@ -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
|
||||
|
||||
@@ -55,8 +55,11 @@ fail_type command_not_found COMMAND_NOT_FOUND
|
||||
fail_type exit EXIT
|
||||
fail_type source_not_found SOURCE_NOT_FOUND
|
||||
fail_type file_not_found FILE_NOT_FOUND
|
||||
fail_type subshell_source_not_found SUBSHELL_SOURCE_NOT_FOUND
|
||||
fail_type subshell_error SUBSHELL_ERROR
|
||||
|
||||
failed=$((TEST_COUNT - SUCCESS_COUNT))
|
||||
|
||||
if [[ $failed -gt 0 ]]; then
|
||||
ratio=$((100 * SUCCESS_COUNT / TEST_COUNT))
|
||||
echo "${ratio}% passed, $SUCCESS_COUNT succeeded, $failed failed!"
|
||||
|
||||
@@ -86,6 +86,18 @@ function do_source_not_found {
|
||||
function do_file_not_found {
|
||||
./lib/fake/nope.bash
|
||||
}
|
||||
|
||||
function do_subshell_source_not_found {
|
||||
output=$(miaou_debug "---subshell1--$$ $BASHPID $PPID--")
|
||||
output=$(miaou_debug "---subshell2--$$ $BASHPID $PPID--")
|
||||
: "$output"
|
||||
"${MIAOU_BASH_DIR}/test/stub/extra/library.bash"
|
||||
|
||||
}
|
||||
|
||||
function do_subshell_error {
|
||||
:
|
||||
}
|
||||
# FUNCTIONS
|
||||
|
||||
function call_function_which_will_exit {
|
||||
|
||||
Reference in New Issue
Block a user