Skip to content

Commit

Permalink
Merge pull request #851 from klaxit/fix/posixly-correct
Browse files Browse the repository at this point in the history
fix: shims break when POSIXLY_CORRECT=1
  • Loading branch information
Stratus3D authored Jan 14, 2021
2 parents bdace81 + 0de6910 commit bd21c99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions test/shim_exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}

0 comments on commit bd21c99

Please sign in to comment.