From 94d87211f978c1fff3ab79537191683d30742079 Mon Sep 17 00:00:00 2001 From: Roy Liu Date: Mon, 19 Sep 2011 10:45:12 -0400 Subject: [PATCH] Restore the current working directory in rbenv-rehash --- libexec/rbenv-rehash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libexec/rbenv-rehash b/libexec/rbenv-rehash index c69a129a..3d9a9a70 100755 --- a/libexec/rbenv-rehash +++ b/libexec/rbenv-rehash @@ -55,6 +55,9 @@ make_shims() { done } +# Save the working directory. +CUR_PATH=$PWD + # Empty out the shims directory and make it the working directory. rm -f "$SHIM_PATH"/* cd "$SHIM_PATH" @@ -68,6 +71,9 @@ make_shims ../versions/*/bin/* RBENV_REHASH_PLUGINS=(/etc/rbenv.d/rehash/*.bash ${RBENV_ROOT}/rbenv.d/rehash/*.bash) shopt -u nullglob +# Restore the previous working directory. +cd "$CUR_PATH" + for script in ${RBENV_REHASH_PLUGINS[@]}; do source $script done