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.
This commit is contained in:
Kevin Burke 2014-11-28 21:16:14 -08:00
parent 7e0e85bdda
commit c9a96c9f79
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ if [ -r "$completion" ]; then
fi fi
if [ -z "$no_rehash" ]; then if [ -z "$no_rehash" ]; then
echo 'rbenv rehash 2>/dev/null' echo 'command rbenv rehash 2>/dev/null'
fi fi
commands=(`rbenv-commands --sh`) commands=(`rbenv-commands --sh`)

View file

@ -14,7 +14,7 @@ load test_helper
@test "auto rehash" { @test "auto rehash" {
run rbenv-init - run rbenv-init -
assert_success assert_success
assert_line "rbenv rehash 2>/dev/null" assert_line "command rbenv rehash 2>/dev/null"
} }
@test "setup shell completions" { @test "setup shell completions" {