Преглед изворни кода

Fix error message when command is not found for "system" version

If `foo` didn't exist and `RBENV_VERSION=system rbenv which foo` was
called, the error message used to be misleading:

    rbenv: version `system' is not installed

Instead, have the error message simply say that the command was not found.

Fixes #770
pull/487/head^2
Mislav Marohnić пре 8 година
родитељ
комит
3405c4d03c
2 измењених фајлова са 7 додато и 1 уклоњено
  1. +1
    -1
      libexec/rbenv-which
  2. +6
    -0
      test/which.bats

+ 1
- 1
libexec/rbenv-which Прегледај датотеку

@ -51,7 +51,7 @@ done
if [ -x "$RBENV_COMMAND_PATH" ]; then
echo "$RBENV_COMMAND_PATH"
elif ! [ -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then
elif [ "$RBENV_VERSION" != "system" ] && [ ! -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then
echo "rbenv: version \`$RBENV_VERSION' is not installed (set by $(rbenv-version-origin))" >&2
exit 1
else

+ 6
- 0
test/which.bats Прегледај датотеку

@ -68,6 +68,12 @@ create_executable() {
assert_failure "rbenv: rake: command not found"
}
@test "no executable found for system version" {
export PATH="$(path_without "rake")"
RBENV_VERSION=system run rbenv-which rake
assert_failure "rbenv: rake: command not found"
}
@test "executable found in other versions" {
create_executable "1.8" "ruby"
create_executable "1.9" "rspec"

Loading…
Откажи
Сачувај