mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge pull request #623 from jonmast/prevent-exec-recursion
Ignore shim directory for executable lookups
This commit is contained in:
commit
62c4fdb163
@ -707,10 +707,8 @@ with_shim_executable() {
|
||||
plugin_path=$(get_plugin_path "$plugin_name")
|
||||
|
||||
run_within_env() {
|
||||
local path=$PATH
|
||||
if [ "system" == "$full_version" ]; then
|
||||
local path
|
||||
path=$(echo "$PATH" | sed -e "s|$(asdf_data_dir)/shims||g; s|::|:|g")
|
||||
fi
|
||||
|
||||
executable_path=$(PATH=$path command -v "$shim_name")
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
load test_helpers
|
||||
|
||||
setup() {
|
||||
cd $BATS_TMPDIR
|
||||
ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
||||
cat > $ASDF_CONFIG_FILE <<-EOM
|
||||
key1 = value1
|
||||
|
@ -96,3 +96,13 @@ teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$ASDF_DIR/installs/dummy/1.1/bin/dummy" ]
|
||||
}
|
||||
|
||||
@test "which should not return shim path" {
|
||||
cd $PROJECT_DIR
|
||||
echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions
|
||||
rm "$ASDF_DIR/installs/dummy/1.0/bin/dummy"
|
||||
|
||||
run env PATH=$PATH:$ASDF_DIR/shims asdf which dummy
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" == "No dummy executable found for dummy 1.0" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user