mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Fix which for when "system" version is present
This commit is contained in:
parent
11882c1151
commit
2eae89c432
@ -9,6 +9,9 @@ which_command() {
|
||||
# shellcheck disable=SC2162
|
||||
IFS=' ' read -a versions <<< "$full_version"
|
||||
for version in "${versions[@]}"; do
|
||||
if [ "$version" = "system" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -f "${plugin_path}/bin/exec-path" ]; then
|
||||
cmd=$(basename "$executable_path")
|
||||
install_path=$(find_install_path "$plugin_name" "$version")
|
||||
@ -31,4 +34,4 @@ which_command() {
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,15 @@ teardown() {
|
||||
[ "$output" = "$ASDF_DIR/installs/dummy/1.0/bin/subdir/other_bin" ]
|
||||
}
|
||||
|
||||
@test "which should ignore system version" {
|
||||
echo 'dummy system 1.0' > $PROJECT_DIR/.tool-versions
|
||||
cd $PROJECT_DIR
|
||||
|
||||
run which_command "other_bin"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$ASDF_DIR/installs/dummy/1.0/bin/subdir/other_bin" ]
|
||||
}
|
||||
|
||||
@test "which should inform when no binary is found" {
|
||||
cd $PROJECT_DIR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user