Standardize version manager script execution #2133
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Closes #2114.
We were not passing the process environment or the shell detected by VS Code to version manager activation scripts.
However, it's becoming more evident that many version managers depend on certain environment variables to properly work (e.g.:
$HOME
). In addition to that, Rubygems itself depends on certain environment variables in order to define what the default and user gem paths are.I think it's worth trying to standardize these script executions to always use the user's selected shell (which some version managers depend on) and make the execution inherit from
process.env
.Notice that we're still not sourcing shell configuration scripts, since we moved away from that due to several integration issues.
Implementation
Created a convenience method
runScript
which always inserts thecwd
,env
andshell
. Started using it everywhere we invoke manager integrations.Small detail:
vscode.env.shell
returns an empty string rather thannull
in operating systems where that value is not set to anything. We do not want to pass an empty string toexec
, but ratherundefined
ornull
.Automated Tests
Adapted our tests.
Manual Tests
Essentially, launch the extension on this branch and ensure the server boots properly.