-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Regression related to process.env.PATH #550
Comments
As far as I know, at least on Mac, Atom will correctly read the environment variables if you start it from the terminal. I've just tested: $ atom
$ PATH=$PATH:/ermahgerd atom Both of these give the desired result - the first is my full PATH, and the second my PATH with the ermahgerd directory. However, if you start Atom normally by clicking its application icon, it doesn't inherit your user environment. If Atom is already open, and you use the |
Nope, no running processes. And it used to work fine when started from the .app bundle as well. |
I'm on 10.9.4 here, I can check on Yosemite later. |
Just tested this on a brand new Yosemite Beta 1 install (clean VM) and I'm seeing exactly the same behavior; all environments variables except |
Confirmed on my copy of Yosemite - other environment variables are fine but PATH is not passed. |
I have something simular on Ubuntu 14.04. When started from launcher the path is This results in linters not working when atom isn't started from a terminal session. |
Any fix for this on yosemite? |
Ive confirmed this on Yosemite as well, it's breaking the |
My fix was setting manually my PATH in the init script If you don't know your path you can get it by running |
I did some digging because I'd love to solve this problem. It appears the regression may be within OS X's What I did to determine this was to directly call |
I have the same issue as well. All variables are passed through except for I'd like to take a look at this later. It doesn't seem like Atom is paying any attention to @acrogenesis idea does work, and that was the first thing I tried. At least, it works in some cases, such as for making sure binaries are available for subprocessing. For things where the binaries are needed on startup, not so much, due to the timing of the init script. I would honestly really prefer that the Atom preferences had some way to specify PATH within the application as well. Inheriting from shell is not always ideal, though it is nice with, say, virtualenv. |
This is true with all Cocoa applications, not just Atom Shell; Cocoa's environment is separate and sanitized from the environment that Terminal runs under. |
We've never had full access to e.g. There are workarounds however. Really hope Georg Nachman doesn't mind that I share this here, but here's what he does
This is how they fixed the issue in RStudio: rstudio/rstudio@09c9be1 |
+1 - This is affecting https://github.com/joefitzgerald/go-plus. The package relies (pretty heavily) on the |
I pushed a fix at atom/atom#4064, can you try if it works for you? I don't have a Yosemite machine currently. |
@zcbenz As I mentioned on the PR, this works! |
🎆 Looking forward to this 🚢-ing. Do we have an estimated Atom version that will be released with this in it? |
Not the best with Coffescript, but for those needing a quick fix check the gist and throw it in your init.coffee. Works on Yosemite just fine, should work on Linux if needed. Uses my zsh config, but should work with anything you set it to. :) |
👍 on the work arounds. FWIW the "open from icon" issue still persists in v0.158 |
Should this be re-opened? Problem (no path when opening from icon) still exists in v0.160 on Yosemite. |
@matthewandrews I think that's a separate problem - OS X doesn't use your bash profile when launching applications from the Dock. See http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x for a good way to set your PATH for that case. |
I've the problem with Python files, pep8 is not found since the path is not evaluated. how can i fix it? |
The cause of the error is undefined @flowpath, which happens in at least the following two cases: - flow is not installed - flow is installed, but process.env.PATH does no longer match the user's $PATH environment variable on OS X, unless Atom is launched from the terminal. electron/electron#550
For anyone looking for a fix for getting the path when run as an app on OS X, see |
We could also adapt the approach taken in https://github.com/atom-community/environment (I.e. Launch the user's shell to get a sane environment of the user launches an electron app via Finder, Dock, Spotlight, open, et al. |
Unfortunately this is reproducible again on El Capitan. When launching Atom from GUI, process.env is always:
When launching atom from command line:
|
@thSoft I have the same issue with you, do you have some updates on this? |
There is a race condition, if I defer the usage of the path by 5 seconds the path is set right! This isn't reproable on every system though. Sometimes it just works even without the deferred access. |
@aadisriram your issue doesn't belong in the electron repo. Feel free to open one in the https://github.com/atom/atom repo. That said, this is by design - see the following for more detail: |
I'm assuming this is controlled by Atom Shell and not Atom, so I'm reporting it here;
process.env.PATH
does no longer match the user's$PATH
environment variable. It is instead some form of system default, "sanitized" value.This regression seems specific to OS X. I have verified
process.env.Path
is not "sanitized" on Windows 8.1 running Atom v0.120.0. The inconsistency might be accidental because on Windows the environment variable is namedPath
and notPATH
. I have not tested to see if the regression also occurs on any GNU/Linux distributions.Tried to scan through the recent commits to figure out when this regression got introduced, but had no such luck... perhaps it's related to the recently upgraded Chromium?
All other environment variables are correctly read (and passed to) Atom. Which means that this works
in that the variable can be read in Atom via e.g.
console.log(process.env.EVERYTHING)
, whereas this$ PATH=$PATH:/ermahgerd atom
does not. Regardless of what I do,
console.log(process.env.PATH)
always displays/usr/bin:/bin:/usr/sbin:/sbin
.Update:
Tested with Atom v0.120.0 and Atom built from source, running on OS X Yosemite Beta 1.
Installing fresh copies of OS X 10.9.4 and 10.10 in VMs now, to see if I can reproduce the old behavior and the regression.
The text was updated successfully, but these errors were encountered: