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
.ruby-version and .ruby-gemset are not used when TMux is started in project dir #3270
Comments
please use gist |
I worked it out: tmux reuses existing sessions, so I when I did So I'm guessing upgrading rvm fixed it, but the existing tmux session was re-used (env variables?). I closed all existing tmux sessions and now it works fine (after the update today). Thanks so much! |
Oh, and |
The problem still occurrs.
Here's how to reproduce the problem:
|
can I see the |
Here it is: https://gist.github.com/e2/a5ebc69867273c305634 It is exactly the same as a plain shell session outside tmux (before entering the project directory) So (given there's a detached tmux in the background somewhere):
|
I did an Initial env varsHere are my env vars right after login (no tmux sessions yet, no changing to project dir): This is the EXACT same config when I start my FIRST tmux session (the one I immediately detach). This is ALSO the EXACT same environment rvm STARTS OUT with inside every NEXT tmux session. And because it is the initial environment for RVM, this condition is never true: https://github.com/wayneeseguin/rvm/blob/master/scripts/rvm#L177-L180 so, project rvm rc reloading is skipped. Correct env vars are never passed to new TMux sessionsAnd here is the env in the project directory before I start the tmux session: https://gist.github.com/anonymous/b57a0ce1d577b0b96663 As you can see, this environment with project-gemset is never passed to new tmux sessions (which copy the env from the existing detached session). Suggested solutionTmux has an option to pass environment variables from the EXISTING environment: And it works if I have in ~/.tmux.conf:
I don't know if all 4 are needed by RVM (GEM_HOME GEM_PATH MY_RUBY_HOME PATH), but I could add a PR for a TMux config section on the rvm-site page. |
As a side note: |
the |
I believe I'm having a related issue, or perhaps the same one. I'm on Ubuntu 16.04 LTS everything updated to latest and when I installed rvm in tmux, it seems to only work in a tmux session now! rvm will still happily run, insisting ruby-2.1.2 is selected, but ruby returns command not found, same with trying bundle. I ran tmux and suddenly it worked. Pretty funny bug |
Same problem for me using tmuxinator. |
I had the same issues. But adding following at the top of
My environment is: |
|
Hello, I am having a similar problem but it isn't happening on tmux, instead it happens on the vs code terminal. I am using vs code with rvm ( 1.29.12 ) installed on ubuntu, when I open a vs code terminal on a ruby project folder it uses the default version that is installed in the machine ( example 2.7.0 ) After using cd . on said terminal, it seems that rvm sets the correct version for the project ( example 2.7.2 ) I made a workaround by adding a cd . at the end of .bash_profile for my user ( I think ) so it loads versions correctly. But I think this might be a problem with how rvm works when opening a new terminal. |
cd
to a project with a.ruby-gemset
file - gemset is correctly set tofoo
tmux
in that directory - gemset is set to(default)
[expected: should be set tofoo
!]Profit!I runcd .
- and gemset is properly set tofoo
Version: just checked on head - same problem
I've checked -
.zlogin
is loaded when new TMux window is opened and it containsrvm
.Is there anything I can do to debug this?
My
.ruby-gemset
hasfoo
and my.ruby-version
hasruby-2.1.5
and my~/.rvmrc
:The text was updated successfully, but these errors were encountered: