wayneeseguin/rvm — pull request #1924 by mpapis (2013-06-03 17:13:42+00:00)
Title: Running an rvm process from within another process

I often use the shebang:

#!/usr/bin/env rvm 1.9 do ruby

However, if that script which is running then needs to invoke another ruby process, it says that rvm is not a function, rvm was not loaded correctly, etc. I tracked it down, and it looks like
this is happening because running with the above shebang sets the environment variable "rvm_is_not_a_shell_function". This then is still active when I try to perform rvm actions, e.g.
"rvm use ...", which causes rvm to warn me about rvm not being a function, even though it actually *is*, at that point.

I got around this problem by setting:

rvm_is_not_a_shell_function=0

inside the command line which starts the process which eventually invokes rvm.

A better solution would be for rvm to not set the environment variable and to check to see if rvm is a function whenever this result is actually needed. I would also be willing to investigate this, myself.