5 ms·
rvm is sweet for managing rubies but not so sweet in that it hijacks cd(). I like to cd without any apps meddling. Recommended fix: $ echo rvm_project_rvmrc=0
by cldwalker 16y ago
rvm is sweet for managing rubies but not so sweet in that it hijacks cd(). I like to cd without any apps meddling.
Recommended fix: $ echo rvm_project_rvmrc=0 >> ~/.rvmrc
- bgentry 16y agoAre you referring to the auto switching of Ruby environments based on a directory change? If so, this latest version disables that by default
- telemachos 16y agoAre you sure about that? .rvm/scripts/cd still has this at the top [1]: # Source a .rvmrc file in a directory after changing to it, if it exists. # To disable this fature, set rvm_project_rvmrc=0 in $HOME/.rvmrc Also, the new security features that Wayne mentions in this post suggest that a cd automatically leads to a check on the directory you cd into. Doesn't that imply that rvm still has to plug itself into cd? (I may be confused here.) I have to admit the cd thing ended up throwing me for an interesting loop at one point. I was scripting and no matter what happened, cd was returning 0 (success) - even when the cd command was actually failing. I could not figure out for the life of me why the right exit status wasn't being reported. It turns out that rvm wasn't saving and then returning the exit status of cd itself. (So the exit status I was capturing wasn't actually that of cd.) Long story short, two minutes in #rvm and Wayne had it fixed [2]. Edit: I think I see the confusion. Cldwalker is saying that he doesn't like rvm tinkering with cd. Bgentry is saying that rvm no longer automatically switches Ruby if it finds a .rvmrc in a folder (after you cd into it). That's right, but it doesn't change what is bothering Cldwalker: rvm does in fact still get in front of cd. (I think 'hijacking' is too strong, but I know what Cldwalker means by it.) If you use rvm, then by default every time you issue cd, rvm runs the code in [1] (part of which obviously punts to the built-in cd). You can disable this behavior, as Cldwalker says, by setting the environment variable rvm_project_rvmrc to 0. Unless I'm wrong, the default is still on. [1] http://github.com/wayneeseguin/rvm/blob/master/scripts/cd http://github.com/wayneeseguin/rvm/blob/master/scripts/cd [2] http://github.com/wayneeseguin/rvm/commit/f9aa3adebcca547924c8095fa7696967bd2d8d15 http://github.com/wayneeseguin/rvm/commit/f9aa3adebcca547924...
- bgentry 16y agoah, you are correct, I saw this bit in the release note earlier and then assumed that Cldwalker was referring to the same issue. So, setting rvm_project_rvmrc=0 will still execute RVM's cd script, but it will skip the part that loads an rvmrc
- telemachos 16y agoSo, setting rvm_project_rvmrc=0 will still execute RVM's cd script, but it will skip the part that loads an rvmrc Not exactly: setting 'rvm_project_rvmrc=0' causes rvm's cd script to immediately bail out. From .rvm/scripts/cd: if [[ "$rvm_project_rvmrc" -ne 0 ]] ; then Everything else in the cd script hangs off that if. So by setting the environment variable, that whole branch (which is the whole script) is skipped and rvm won't get in front of cd.