test elapsed time
This commit is contained in:
+20
-16
@@ -85,23 +85,26 @@ function on_return {
|
||||
|
||||
# overridden function which permits backtracing of the original `exit` statement
|
||||
function exit {
|
||||
error_source=("${BASH_SOURCE[@]}")
|
||||
error_lineno=("${BASH_LINENO[@]}")
|
||||
error_funcname=("${FUNCNAME[@]}")
|
||||
unset 'error_source[-1]' 'error_lineno[-1]' 'error_funcname[-1]'
|
||||
unset 'error_source[0]' 'error_lineno[-1]' 'error_funcname[0]'
|
||||
error_funcname[-1]='<main>'
|
||||
error_source=("${error_source[@]}")
|
||||
error_lineno=("${error_lineno[@]}")
|
||||
error_funcname=("${error_funcname[@]}")
|
||||
code=${1:-0}
|
||||
if [[ $code -gt 0 ]]; then
|
||||
error_source=("${BASH_SOURCE[@]}")
|
||||
error_lineno=("${BASH_LINENO[@]}")
|
||||
error_funcname=("${FUNCNAME[@]}")
|
||||
unset 'error_source[-1]' 'error_lineno[-1]' 'error_funcname[-1]'
|
||||
unset 'error_source[0]' 'error_lineno[-1]' 'error_funcname[0]'
|
||||
error_funcname[-1]='<main>'
|
||||
error_source=("${error_source[@]}")
|
||||
error_lineno=("${error_lineno[@]}")
|
||||
error_funcname=("${error_funcname[@]}")
|
||||
|
||||
failure_code=${1:-0}
|
||||
failure_type="EXIT"
|
||||
failure_payload="${error_funcname[0]}"
|
||||
failure_code=${1:-0}
|
||||
failure_type="EXIT"
|
||||
failure_payload="${error_funcname[0]}"
|
||||
|
||||
miaou_debug "<exit code=$failure_code overridden/>"
|
||||
print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}"
|
||||
builtin exit "$failure_code"
|
||||
miaou_debug "<overridden_exit code=$failure_code/>"
|
||||
print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}"
|
||||
fi
|
||||
builtin exit "$code"
|
||||
}
|
||||
|
||||
function tty_ansi {
|
||||
@@ -135,7 +138,8 @@ function add_miaou_error {
|
||||
function on_error {
|
||||
trap - RETURN
|
||||
failure_code="${1:-200}"
|
||||
>&4 printf '\r' # TODO: force carriage return explicitly, is it really useful?
|
||||
|
||||
# >&4 printf '\r' # TODO: force carriage return explicitly, is it really useful?
|
||||
|
||||
miaou_debug "<on_error code=${failure_code} command={${BASH_COMMAND}}>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user