I'm using osx, and launch oni from the .app image. Opening a nvim terminal gives me a working directory of /, and :echo $PATH gives /usr/bin:/bin:/usr/sbin:/sbin, which is not what my PATH is. This is a real hassle, since I can't even run ag because it's not in this weirdly short PATH.
Hi @Alok , thanks for logging the issue!
Yes, seems like we're not passing $PATH correctly to the spawned Neovim process.
If anyone is interested in checking this out, this would be a good place to look: https://github.com/extr0py/oni/blob/a9347b81c9749f9b14fa7a44eca255aa2f3bf65c/browser/src/neovim/NeovimProcessSpawner.ts#L43
It seems like we should pass-through the environment variables. We should also check and make sure that process.env is returning the expected values.
There's actually code here to pass in the current PATH variable: https://github.com/extr0py/oni/blob/eed7659f961d228f60dd3163e06a00b75fc0ef3e/browser/src/Plugins/Api/Process.ts#L22
Might be worth trying just using spawnProcess from there, which would bring in the path variable.
Hi @Alok ,
I dug a bit more into this. When opening Oni from the .app image, it's expected that it wouldn't get the $PATH from your environment (since that is specific to bash).
Unfortunately, it looks like nvim doesn't source the .bash_profile when opening the neovim terminal. To get the behavior you want, you need to make sure you source your bash profile. This stack overflow has some ideas here: https://stackoverflow.com/questions/33926383/how-can-i-force-nvim-to-source-my-bash-profile-when-creating-a-terminal-buffer
(It's pretty much just calling source $HOME/.bash_profile when the terminal loads).
Hope that helps. It might be worth checking in on the neovim repo and see if there is an issue / setting for always loading the .bash_profile. I'll close this for now, but feel free to reopen if you think there is a fix on the Oni side.
I think this should be re-opened and taken care of. At least, it should source /etc/profile to configure $PATH. For example, /Library/TeX/texbin/latexmk is added to $PATH from /etc/profile, not bash_profile. Other applications such as vimr automatically does this but oni doesn't.
There have been a few changes to this since this issue (most recently #2440) which aren't in the latest release, and should help with this @wookayin. If its still not sorted in the next release/master, then it is worth opening a new issue.
@CrossR part of this issue is also (I think) that the Process we use to start scripts which uses shellEnv as a dynamic import I believe is broken I think with the way webpack handles dynamic imports now what is imported is actually { default: shellEnvModule } and the shell env fetcher basically is silently failing, I think #2440 is a work around but the root cause is that
Most helpful comment
There have been a few changes to this since this issue (most recently #2440) which aren't in the latest release, and should help with this @wookayin. If its still not sorted in the next release/master, then it is worth opening a new issue.