Skip to content

Commit 56d1dd4

Browse files
authored
Fix to respect environment reporting setting in fish (microsoft#242234)
* fix to respect env setting in fish * take the if clause outside of __vsc_update_env
1 parent a7b227e commit 56d1dd4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ and ! set --query VSCODE_SHELL_INTEGRATION
2121
or exit
2222

2323
set --global VSCODE_SHELL_INTEGRATION 1
24+
set --global __vscode_shell_env_reporting $VSCODE_SHELL_ENV_REPORTING
25+
set -e VSCODE_SHELL_ENV_REPORTING
2426

2527
# Apply any explicit path prefix (see #99878)
2628
# On fish, '$fish_user_paths' is always prepended to the PATH, for both login and non-login shells, so we need
@@ -149,14 +151,16 @@ function __vsc_update_cwd --on-event fish_prompt
149151
end
150152
end
151153

152-
function __vsc_update_env --on-event fish_prompt
153-
__vsc_esc EnvSingleStart 1
154-
for line in (env)
155-
set myVar (echo $line | awk -F= '{print $1}')
156-
set myVal (echo $line | awk -F= '{print $2}')
157-
__vsc_esc EnvSingleEntry $myVar (__vsc_escape_value "$myVal")
154+
if test "$__vscode_shell_env_reporting" = "1"
155+
function __vsc_update_env --on-event fish_prompt
156+
__vsc_esc EnvSingleStart 1
157+
for line in (env)
158+
set myVar (echo $line | awk -F= '{print $1}')
159+
set myVal (echo $line | awk -F= '{print $2}')
160+
__vsc_esc EnvSingleEntry $myVar (__vsc_escape_value "$myVal")
161+
end
162+
__vsc_esc EnvSingleEnd
158163
end
159-
__vsc_esc EnvSingleEnd
160164
end
161165

162166
# Sent at the start of the prompt.

0 commit comments

Comments
 (0)