mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-11 21:13:46 -05:00
Merge pull request #567 from genezys/patch-1
Remove carriage return characters in version file Fixes #566
This commit is contained in:
@@ -8,6 +8,7 @@ VERSION_FILE="$1"
|
|||||||
if [ -e "$VERSION_FILE" ]; then
|
if [ -e "$VERSION_FILE" ]; then
|
||||||
# Read the first non-whitespace word from the specified version file.
|
# 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.
|
# 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") )
|
words=( $(cut -b 1-1024 "$VERSION_FILE") )
|
||||||
version="${words[0]}"
|
version="${words[0]}"
|
||||||
|
|
||||||
|
|||||||
@@ -64,3 +64,9 @@ IN
|
|||||||
run rbenv-version-file-read my-version
|
run rbenv-version-file-read my-version
|
||||||
assert_success "1.8.7"
|
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"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user