vscode
vscode copied to clipboard
Correct handling of ZDOTDIR variable
fix: https://github.com/microsoft/vscode/issues/160889 ref: https://github.com/microsoft/vscode/issues/160920
When vscode is started from the integrated terminal, the environment variables are taken over.
Therefore, the ZDOTDIR
of the starting vscode is oriented to the tmp directory(os.tmpdir()
).
This causes a problem that the user's ZDOTDIR
cannot be reflected.
It also causes an infinite loop of calling .zshenv in tmpdir from .zshenv in tmpdir( This seems to be causing the zsh crashes I have reported ).
Therefore, I have changed the allocation method of USER_ZDOTDIR
.
This behavior was discovered by inserting the following code into the code below (between line 4 and 5) https://github.com/microsoft/vscode/blob/17bb582b8580e77ec7eaf59f980a3f7b3dfde541/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh#L4-L5
env > ~/vscode-debug/$(gdate +%s)
from iTerm2 env dump
SHLVL=2
HOME=/Users/yk-yamada
GIT_ASKPASS=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Users/yk-yamada/Projects/github.com/yamachu/vscode/.build/electron/Code - OSS.app/Contents/Frameworks/Code - OSS Helper.app/Contents/MacOS/Code - OSS Helper
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/vscode-git-2152275826.sock
VSCODE_INJECTION=1
ZDOTDIR=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/yk-yamada-vscode-zsh
USER_ZDOTDIR=/Users/yk-yamada
_=/usr/bin/env
vscode that was run from integrated vscode zsh
SHLVL=4
HOME=/Users/yk-yamada
ZDOTDIR=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/yk-yamada-vscode-zsh
USER_ZDOTDIR=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/yk-yamada-vscode-zsh
GIT_ASKPASS=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Users/yk-yamada/Projects/github.com/yamachu/vscode/.build/electron/Code - OSS.app/Contents/Frameworks/Code - OSS Helper.app/Contents/MacOS/Code - OSS Helper
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/vscode-git-8ecc674759.sock
VSCODE_INJECTION=1
_=/usr/bin/env
with this fix
SHLVL=4
HOME=/Users/yk-yamada
ZDOTDIR=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/yk-yamada-vscode-zsh
USER_ZDOTDIR=/Users/yk-yamada
GIT_ASKPASS=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Users/yk-yamada/Projects/github.com/yamachu/vscode/.build/electron/Code - OSS.app/Contents/Frameworks/Code - OSS Helper.app/Contents/MacOS/Code - OSS Helper
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=/Users/yk-yamada/Projects/github.com/yamachu/vscode/extensions/git/out/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/s6/yfw89gs13k78dfw2pdpj3w6h0000gp/T/vscode-git-8ecc674759.sock
VSCODE_INJECTION=1
_=/usr/bin/env