Closed molant closed 6 years ago
love it, thanks!
why do you need to refreshenv?
@gep13 can say more, but I believe it's because code will not be in the path after doing choco install -y vscode
and it is required in order to install the extensions.
See https://github.com/Microsoft/windows-dev-box-setup-scripts/pull/48#discussion_r195328690
That is what I suspect it required yes. I ran into this during a demo I was given.
Also, here in this package:
https://chocolatey.org/packages/vscode-powershell
A refresh is required, or at least, it was.
One Thought, just have choco vs code and the vs packages to refresh. Where does one submit a PR for those?
@crutkas said... One Thought, just have choco vs code and the vs packages to refresh. Where does one submit a PR for those?
I am not sure that I follow your train of thought here. Can you please elaborate?
sorry, if we need to do a refresh for the environment, wouldn't the better spot to do the adjustment is actually in the choco package? that way everyone gets the update versus only someone that uses our scripts
sorry, if we need to do a refresh for the environment, wouldn't the better spot to do the adjustment is actually in the choco package? that way everyone gets the update versus only someone that uses our scripts
@crutkas unfortunately Windows doesn't quite work that nicely. Even if those packages call Update-SessionEnvironment
(aka refreshenv
for PowerShell.exe), it won't matter once the choco.exe process exits and it moves back up to the powershell.exe process. A subprocess can update the environment variables all it wants in that process, and when it exits, the parent process won't see the changes. If it makes permanent changes to User/System environment variables, that also won't be seen in command shells until the shell is closed and reopened.
Chocolatey however has a concept of refreshenv
, that will review the changes in the registry and update the process environment variables with the changes. There is refreshenv.cmd for cmd.exe command shells, and there is Update-SessionEnvironment
, which is aliased to refreshenv
when the Chocolatey PowerShell profile is installed. As you can guess, running refreshenv
in PowerShell without that profile loaded, it's going to call refreshenv.cmd, starting a cmd.exe subprocess, updating those environment variables in that subprocess, and then exiting and having no changes to the current PowerShell.exe command shell.
Does all of that make sense?
@ferventcoder so if I've understood correctly I have to replace refreshenv
with Update-SessionEnvironment
in this PR?
@molant since everything here is running in PowerShell, yes, that would be the safest thing to do.
Install automatically VS Code debugger extensions for Chrome an Edge
Ref: #46