PATH not up to date when starting VSCode
If this would be better reported up to the Command Palette repo, let me know.
When PATH is updated by an app (ex: I installed node), the PATH variable used by spawned apps is not updated until Command Palette is restarted.
Chain of events:
- Install node using winget in built-in terminal in VSCode
- node/npm cannot be run, command not found.
- Close VSCode, restart workspace from Command Palette
- still not finding extension
- Confirm that node runs in a separate, fresh terminal
- Exit Command Palette and restart it
- node can be called from VSCode terminal as expected
Not sure if this is something that can be fixed on the extension level, or if it's an issue with Command Palette generally. I don't remember this happening with Powertoys Run, but can't say for sure (it's not something that comes up often)
I’m not familiar with this issue, and from the description it sounds like the behavior might be unrelated to this extension. It may be something at the Command Palette level rather than something we can address here.
Ran into this today and cost me a ton of time to troubleshoot. This affects all envvars, not just PATH. The root cause is that the vscode process when run through this plugin is under a long tree of processes started before you do any environment variable changes (I recommend using sysinternals procmon to see that for yourself). I won't be using this extension anymore, this is unacceptable.
see https://github.com/microsoft/PowerToys/issues/42306
I'll close this then - that seems to confirm it is an issue at the Command Palette level.
Revisited and fixed this issue.
Visual Studio Code
- The PATH now updates correctly after all VS Code instances are closed and reopened, following VS Code's documented behaviour"
- If this is the first VS Code instance, environment variables are inherited from the parent process.
- If this is not the first VS Code instance, environment variables are inherited from the already running VS Code instance.
Visual Studio
- The PATH updates without requiring all Visual Studio instances to be closed.