diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh index 9df11a6a4de..51053817541 100755 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh @@ -34,13 +34,7 @@ if [ "$VSCODE_INJECTION" == "1" ]; then fi builtin unset VSCODE_SHELL_LOGIN - # On macOS the profile calls path_helper which adds a bunch of standard bin directories to - # the beginning of the PATH. This causes significant problems for the environment variable - # collection API as the custom paths added to the end will now be somewhere in the middle of - # the PATH. To combat this, VSCODE_PATH_PREFIX is used to re-apply any prefix after the - # profile has run. This will cause duplication in the PATH but should fix the issue. - # - # See #99878 for more information. + # Apply any explicit path prefix (see #99878) if [ -n "$VSCODE_PATH_PREFIX" ]; then export PATH=$VSCODE_PATH_PREFIX$PATH builtin unset VSCODE_PATH_PREFIX diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh index 6803fd9782f..30d8cc9e451 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh @@ -7,4 +7,10 @@ if [[ $options[norcs] = off && -o "login" && -f $USER_ZDOTDIR/.zprofile ]]; the ZDOTDIR=$USER_ZDOTDIR . $USER_ZDOTDIR/.zprofile ZDOTDIR=$VSCODE_ZDOTDIR + + # Apply any explicit path prefix (see #99878) + if (( ${+VSCODE_PATH_PREFIX} )); then + export PATH=$VSCODE_PATH_PREFIX$PATH + builtin unset VSCODE_PATH_PREFIX + fi fi diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish index 565fdf7bb87..5f367418719 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish @@ -22,6 +22,12 @@ or exit set --global VSCODE_SHELL_INTEGRATION 1 +# Apply any explicit path prefix (see #99878) +if status --is-login; and set -q VSCODE_PATH_PREFIX + fish_add_path -p $VSCODE_PATH_PREFIX + set -e VSCODE_PATH_PREFIX +end + # Helper function function __vsc_esc -d "Emit escape sequences for VS Code shell integration" builtin printf "\e]633;%s\a" (string join ";" $argv)