From c9a96c9f79c1cce3d4b44e59b789ca92e0053937 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Fri, 28 Nov 2014 21:16:14 -0800 Subject: [PATCH] Use `command` to run rbenv rehash In the event that `eval "$(rbenv init -)"` is called from a function named rbenv (which I do to get rbenv to load lazily in my shell), evaluating the phrase `rbenv rehash` will cause the outer function to run again (causing an infinite loop). This change makes it clear you want the command named rbenv and not a function which may exist in the environment. --- libexec/rbenv-init | 2 +- test/init.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 0b2c13aa..867b3bb8 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -88,7 +88,7 @@ if [ -r "$completion" ]; then fi if [ -z "$no_rehash" ]; then - echo 'rbenv rehash 2>/dev/null' + echo 'command rbenv rehash 2>/dev/null' fi commands=(`rbenv-commands --sh`) diff --git a/test/init.bats b/test/init.bats index 95db0fec..b59b8086 100644 --- a/test/init.bats +++ b/test/init.bats @@ -14,7 +14,7 @@ load test_helper @test "auto rehash" { run rbenv-init - assert_success - assert_line "rbenv rehash 2>/dev/null" + assert_line "command rbenv rehash 2>/dev/null" } @test "setup shell completions" {