We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probably won't because we don't have trap ERR yet
trap ERR
https://lobste.rs/s/ajoaje/first_two_statements_your_bash_script#c_u6hdcf
trap 'stacktrace "Error trapped rc=${PIPESTATUS[@]}, see trace above"' ERR stacktrace() { local frame="${#FUNCNAME[@]}" echo >&2 "Stacktrace:" while [[ "${frame}" -gt 1 ]]; do ((frame--)) echo >&2 " File ${BASH_SOURCE[$frame]}#L${BASH_LINENO[$((frame - 1))]} (in ${FUNCNAME[$frame]}())" done if [[ "$#" -gt 0 ]]; then echo >&2 "$1" fi }
The text was updated successfully, but these errors were encountered:
As for the implementation of stacktrace, the implementation by ble.sh might be more useful. It supports BASH_ARGV (set by extdebug).
stacktrace
ble.sh
BASH_ARGV
extdebug
_ble_util_stackdump_title=stackdump function ble/util/stackdump { ((bleopt_internal_stackdump_enabled)) || return 1 local message=$1 local i nl=$'\n' local message="$_ble_term_sgr0$_ble_util_stackdump_title: $message$nl" local iarg=$BASH_ARGC args= extdebug= shopt -q extdebug 2>/dev/null && extdebug=1 for ((i=1;i<${#FUNCNAME[*]};i++)); do if [[ $extdebug ]] && ((BASH_ARGC[i])); then args=("${BASH_ARGV[@]:iarg:BASH_ARGC[i]}") ble/array#reverse args args=" ${args[*]}" ((iarg+=BASH_ARGC[i])) else args= fi message="$message @ ${BASH_SOURCE[i]}:${BASH_LINENO[i-1]} (${FUNCNAME[i]}$args)$nl" done ble/util/put "$message" }
Sorry, something went wrong.
Note #709 has a code snippet with set -E / errtrace
set -E / errtrace
No branches or pull requests
Probably won't because we don't have
trap ERR
yethttps://lobste.rs/s/ajoaje/first_two_statements_your_bash_script#c_u6hdcf
The text was updated successfully, but these errors were encountered: