Merge pull request #567 from genezys/patch-1

Remove carriage return characters in version file

Fixes #566
This commit is contained in:
Mislav Marohnić 2014-03-21 17:22:03 +01:00
commit f71e22768c
2 changed files with 7 additions and 0 deletions

View file

@ -8,6 +8,7 @@ VERSION_FILE="$1"
if [ -e "$VERSION_FILE" ]; then
# Read the first non-whitespace word from the specified version file.
# Be careful not to load it whole in case there's something crazy in it.
IFS="${IFS}"$'\r'
words=( $(cut -b 1-1024 "$VERSION_FILE") )
version="${words[0]}"

View file

@ -64,3 +64,9 @@ IN
run rbenv-version-file-read my-version
assert_success "1.8.7"
}
@test "ignores carriage returns" {
cat > my-version <<< $'1.9.3\r'
run rbenv-version-file-read my-version
assert_success "1.9.3"
}