From db2a94d4bc95647cf7d57e394d9c1324f8e2c755 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 9 Sep 2011 15:52:31 -0500 Subject: [PATCH] `rbenv-version-name` returns `system` for empty version files. Closes #62, #65, #77. --- libexec/rbenv-version-file-read | 4 ++-- libexec/rbenv-version-name | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rbenv-version-file-read b/libexec/rbenv-version-file-read index a7b02c0..74f7acb 100755 --- a/libexec/rbenv-version-file-read +++ b/libexec/rbenv-version-file-read @@ -13,6 +13,6 @@ if [ -e "$VERSION_FILE" ]; then break fi done < <( cat "$VERSION_FILE" && echo ) -else - exit 1 fi + +exit 1 diff --git a/libexec/rbenv-version-name b/libexec/rbenv-version-name index 4782de7..195d134 100755 --- a/libexec/rbenv-version-name +++ b/libexec/rbenv-version-name @@ -6,8 +6,8 @@ if [ -z "$RBENV_VERSION" ]; then RBENV_VERSION="$(rbenv-version-file-read "$RBENV_VERSION_FILE" || true)" fi -if [ "$RBENV_VERSION" = "system" ]; then - echo "$RBENV_VERSION" +if [ -z "$RBENV_VERSION" ] || [ "$RBENV_VERSION" = "system" ]; then + echo "system" exit fi