From c4a44d3bd5c311c3b899b2b65d547d32bcfa9360 Mon Sep 17 00:00:00 2001 From: tnarik Date: Fri, 23 Nov 2012 11:36:06 +0000 Subject: [PATCH] Fix #1324 from https://github.com/wayneeseguin/rvm. 'rvm_environements_path/default' is sourced only if 'rvm_action' is not switch. 'rvm_scripts_path/rvm' doesn't get sourced if it doesn't exist, in the final step of the 'cli' execution. This allows for a proper teardown of the internal variables. --- scripts/cli | 2 +- scripts/rvm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/cli b/scripts/cli index 8499d0c0a5..ac3286fb4a 100755 --- a/scripts/cli +++ b/scripts/cli @@ -1091,7 +1091,7 @@ To reinstall use: __local_rvm_trace_flag=${rvm_trace_flag:-0} if - [[ ${rvm_reload_flag:-0} -eq 1 ]] + [[ ${rvm_reload_flag:-0} -eq 1 && -s "$rvm_scripts_path/rvm" ]] then __rvm_project_rvmrc_lock=0 source "$rvm_scripts_path/rvm" diff --git a/scripts/rvm b/scripts/rvm index 1631e69e8f..9c24497f48 100755 --- a/scripts/rvm +++ b/scripts/rvm @@ -132,7 +132,7 @@ then builtin command -v ruby | GREP_OPTIONS="" \grep -v "${rvm_path}" >/dev/null || builtin command -v ruby | GREP_OPTIONS="" \grep "${rvm_path}/bin/ruby$" >/dev/null then - if [[ -s "$rvm_environments_path/default" ]] + if [[ -s "$rvm_environments_path/default" && "${rvm_action}" != "switch" ]] then source "$rvm_environments_path/default" elif [[ -s "$rvm_path/environments/default" ]]