Merge pull request #851 from klaxit/fix/posixly-correct

fix: shims break when POSIXLY_CORRECT=1
This commit is contained in:
Trevor Brown 2021-01-14 09:27:27 -05:00 committed by GitHub
commit bd21c99a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -663,7 +663,10 @@ preset_versions() {
select_from_preset_version() {
shim_name=$1
grep -f <(get_shim_versions "$shim_name") <(preset_versions "$shim_name") | head -n 1 | xargs -IVERSION printf "%s\\n" VERSION
shim_versions=$(get_shim_versions "$shim_name")
if [ -n "$shim_versions" ]; then
preset_versions "$shim_name" | grep -F "$shim_versions" | head -n 1 | xargs -IVERSION printf "%s\\n" VERSION
fi
}
select_version() {

View File

@ -436,3 +436,15 @@ EOM
[ "$status" -eq 1 ]
}
# From @tejanium in https://github.com/asdf-vm/asdf/issues/581#issuecomment-635337727
@test "asdf exec should not crash when POSIXLY_CORRECT=1" {
export POSIXLY_CORRECT=1
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
run asdf install
run asdf exec dummy world hello
echo $output
[ "$output" == "This is Dummy 1.0! hello world" ]
[ "$status" -eq 0 ]
}