From f1fdb9bbc8d25f51cccd039305e5517684463899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 31 Oct 2013 20:16:26 +0200 Subject: [PATCH] Avoid invoking `hash -r` in fish It doesn't exist as a builtin, and it doesn't seem there is a way to detect support for a shell builtin that is portable. So, just detect fish and don't the rehash command at all. Fixes #478 --- libexec/rbenv-sh-rehash | 6 ++---- test/rehash.bats | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libexec/rbenv-sh-rehash b/libexec/rbenv-sh-rehash index 2fcd3e44..a81dae7f 100755 --- a/libexec/rbenv-sh-rehash +++ b/libexec/rbenv-sh-rehash @@ -15,11 +15,9 @@ rbenv-rehash case "$shell" in fish ) - or='; or' + # no rehash support ;; * ) - or='||' + echo "hash -r 2>/dev/null || true" ;; esac - -echo "hash -r 2>/dev/null $or true" diff --git a/test/rehash.bats b/test/rehash.bats index 54f0f4a6..ba12a245 100755 --- a/test/rehash.bats +++ b/test/rehash.bats @@ -109,6 +109,6 @@ SH @test "sh-rehash in fish" { create_executable "2.0" "ruby" RBENV_SHELL=fish run rbenv-sh-rehash - assert_success "hash -r 2>/dev/null ; or true" + assert_success "" assert [ -x "${RBENV_ROOT}/shims/ruby" ] }