handle debug traps with [[ specially (#157544)

* fix #154189

* add comment
This commit is contained in:
Megan Rogge 2022-08-08 10:54:56 -07:00 committed by GitHub
parent ff1d2abb84
commit 9395d5e43f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,14 @@ if [[ -n "${bash_preexec_imported:-}" ]]; then
precmd_functions+=(__vsc_prompt_cmd)
preexec_functions+=(__vsc_preexec_only)
else
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
__vsc_dbg_trap="$(trap -p DEBUG)"
if [[ "$__vsc_db_trap" =~ .*\[\[.* ]]; then
#HACK - is there a better way to do this?
__vsc_dbg_trap=${__vsc_dbg_trap#'trap -- '*}
__vsc_dbg_trap=${__vsc_dbg_trap%'DEBUG'}
else
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
fi
if [[ -z "$__vsc_dbg_trap" ]]; then
__vsc_preexec_only() {
if [ "$__vsc_in_command_execution" = "0" ]; then