Skip to content

Commit

Permalink
disable shell integration for complex debug trap (#157945)
Browse files Browse the repository at this point in the history
* fix #157851

* move return to earlier

* Still run init scripts and then return

Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>

Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
  • Loading branch information
meganrogge and Tyriar committed Aug 12, 2022
1 parent 78df6ca commit 9270d91
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -37,6 +37,12 @@ if [ -z "$VSCODE_SHELL_INTEGRATION" ]; then
builtin return
fi

# Return for complex debug traps to avoid
# issues like https://github.com/microsoft/vscode/issues/157851
if [[ "$(trap -p DEBUG)" =~ .*\[\[.* ]]; then
builtin return;
fi

# Send the IsWindows property if the environment looks like Windows
if [[ "$(uname -s)" =~ ^CYGWIN*|MINGW*|MSYS* ]]; then
builtin printf "\x1b]633;P;IsWindows=True\x07"
Expand Down Expand Up @@ -129,14 +135,7 @@ if [[ -n "${bash_preexec_imported:-}" ]]; then
precmd_functions+=(__vsc_prompt_cmd)
preexec_functions+=(__vsc_preexec_only)
else
__vsc_dbg_trap="$(trap -p DEBUG)"
if [[ "$__vsc_dbg_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
__vsc_dbg_trap="$(trap -p DEBUG | cut -d' ' -f3 | tr -d \')"
if [[ -z "$__vsc_dbg_trap" ]]; then
__vsc_preexec_only() {
if [ "$__vsc_in_command_execution" = "0" ]; then
Expand Down

0 comments on commit 9270d91

Please sign in to comment.