Skip to content

Commit c460a60

Browse files
authored
better fix for complex debug traps (microsoft#158124)
fix microsoft#157851
1 parent aa0e7b7 commit c460a60

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ if [ -z "$VSCODE_SHELL_INTEGRATION" ]; then
3737
builtin return
3838
fi
3939

40-
# Return for complex debug traps to avoid
41-
# issues like https://github.com/microsoft/vscode/issues/157851
42-
if [[ "$(trap -p DEBUG)" =~ .*\[\[.* ]]; then
43-
builtin return;
44-
fi
45-
4640
# Send the IsWindows property if the environment looks like Windows
4741
if [[ "$(uname -s)" =~ ^CYGWIN*|MINGW*|MSYS* ]]; then
4842
builtin printf "\x1b]633;P;IsWindows=True\x07"
@@ -135,7 +129,16 @@ if [[ -n "${bash_preexec_imported:-}" ]]; then
135129
precmd_functions+=(__vsc_prompt_cmd)
136130
preexec_functions+=(__vsc_preexec_only)
137131
else
138-
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
132+
__vsc_dbg_trap="$(trap -p DEBUG)"
133+
if [[ "$__vsc_dbg_trap" =~ .*\[\[.* ]]; then
134+
#HACK - is there a better way to do this?
135+
__vsc_dbg_trap=${__vsc_dbg_trap#'trap -- '*}
136+
__vsc_dbg_trap=${__vsc_dbg_trap%' DEBUG'}
137+
__vsc_dbg_trap=${__vsc_dbg_trap#"'"*}
138+
__vsc_dbg_trap=${__vsc_dbg_trap%"'"}
139+
else
140+
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
141+
fi
139142
if [[ -z "$__vsc_dbg_trap" ]]; then
140143
__vsc_preexec_only() {
141144
if [ "$__vsc_in_command_execution" = "0" ]; then

0 commit comments

Comments
 (0)