-
Notifications
You must be signed in to change notification settings - Fork 39.7k
Prepending PATH env var with environmentVariableCollection doesn't work on macOS #99878
Copy link
Copy link
Labels
apifeature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersmacosIssues with VS Code on MAC/OS XIssues with VS Code on MAC/OS Xterminal-shell-integrationShell integration infrastructure, command decorations, etc.Shell integration infrastructure, command decorations, etc.verification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Milestone
Metadata
Metadata
Assignees
Labels
apifeature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersmacosIssues with VS Code on MAC/OS XIssues with VS Code on MAC/OS Xterminal-shell-integrationShell integration infrastructure, command decorations, etc.Shell integration infrastructure, command decorations, etc.verification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
This was covered a little bit in #94153 but that issue is locked and can't be discussed there. This feature feels pretty broken on macOS and I hope might be revisited.
The issue is on macOS prepending to
PATH:This ends up being added to the end of the path, rather than the start. @Tyriar wrote up why this is in microsoft/vscode-docs@38653d4 and offered two workarounds, however neither of them are usable in my testing (as well as not really being feasible to tell all users to change):
"terminal.integrated.inheritEnv": falsemakes no difference at all, the PATH till is added to the end (this is a problem because the purpose of usingprependabove is that we need to override any existing SDK on PATH with the one the user just selected)"terminal.integrated.shellArgs": []results in a completely emptyPATHbesides the values I've prepended, which means that pretty much everything else is missing and won't work. This might be solvable by pushingprocess.env.PATHintoenvironmentVariableCollectiontoo, however the prompt to the user would look ridiculous as it would include their entire PATHI appreciate this probably isn't VS Code's fault, but given macOS is fairly common and this behaviour seems to happen on a clean macOS install (it happens on both of mine, and I've customised almost nothing) it feels like it's worth trying to fix (maybe even if it means sending
export PATH=foo:$PATHonce the shell is initialised? 😄).