-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PATH environment variable not consistent for Extension Host #106783
Comments
Is this randomness caused by whether you launch via the CLI or the dock? Note you'll need to close the app with cmd+Q in between checking as the environment won't refresh without fully exiting. |
I almost always run it from the Dock and when I run it from command line it's usually from the VSCode terminal. Another way the app is opened is when macOS launches it automatically after a reboot (e.g. if the OS freezes and you need to shut it down holding the power button). I'll try to see if that is what's causing it, but I'm pretty sure it also happened a few times after running it from the Dock. Thanks |
I can confirm this problem too. |
I can confirm that this happens by just launching it from the Dock:
From what I remember using "Developer: Reload Window" does not always work either though (i.e. I'm sure I tried it before and the PATH was still "wrong" after doing it) |
Related to #30847. And, the comment, #30847 (comment), is helpful. You can find similar issues searching with the words |
/duplicate #30847 |
e790b931385d72cf5669fcefc51cdf65990efa5d
10.15.6 (19G2021)
Steps to Reproduce:
Description:
When running an extension locally (Extension Host) the result/value of
process.env.PATH
varies between it reflecting the PATH I have defined in my shell and just/usr/bin:/bin:/usr/sbin:/sbin
Basically most of the time the value of
process.env.PATH
corresponds to the results of typingprintenv PATH
in my terminal window (I use fish as my default shell) but sometimes it just returns/usr/bin:/bin:/usr/sbin:/sbin
.My extension uses
execFile
in order to run a command line tool that I have installed in abin
folder under my user home dir. however whenprocess.env.PATH
only return the "default" directories listed above, the command is not found (ENOENT
).While I appreciate there are several workarounds to this, it took me a while to figure out what was causing
execFile
to fail since the behaviour happens randomly and I would expect the value ofprocess.env.PATH
to be consistent.Furthermore I never managed to reproduce this using the extension debugger (I ended up having to log the value of
process.env.PATH
to the extension output channel)The text was updated successfully, but these errors were encountered: