Browse Source

Use `command` and `type` instead of `which` (#2144)

`which` has been deprecated in Debian's debianutils 5.0+
They suggest using `type` and `command` as replacements:
3a8dd10b45 ,
610a65c6ef
pull/2157/head
Ville Skyttä 2 years ago
committed by GitHub
parent
commit
a9e11ba164
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      plugins/python-build/test/pyenv.bats
  2. +2
    -2
      test/test_helper.bash

+ 2
- 2
plugins/python-build/test/pyenv.bats View File

@ -183,7 +183,7 @@ OUT
} }
@test "pyenv-install has usage help preface" { @test "pyenv-install has usage help preface" {
run head "$(which pyenv-install)"
run head "$(command -v pyenv-install)"
assert_output_contains 'Usage: pyenv install' assert_output_contains 'Usage: pyenv install'
} }
@ -212,6 +212,6 @@ OUT
} }
@test "pyenv-uninstall has usage help preface" { @test "pyenv-uninstall has usage help preface" {
run head "$(which pyenv-uninstall)"
run head "$(command -v pyenv-uninstall)"
assert_output_contains 'Usage: pyenv uninstall' assert_output_contains 'Usage: pyenv uninstall'
} }

+ 2
- 2
test/test_helper.bash View File

@ -116,12 +116,12 @@ path_without() {
local path=":${PATH}:" local path=":${PATH}:"
for exe; do for exe; do
local found alt util local found alt util
for found in $(PATH="$path" which -a "$exe"); do
for found in $(PATH="$path" type -aP "$exe"); do
found="${found%/*}" found="${found%/*}"
if [ "$found" != "${PYENV_ROOT}/shims" ]; then if [ "$found" != "${PYENV_ROOT}/shims" ]; then
alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')" alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')"
mkdir -p "$alt" mkdir -p "$alt"
for util in bash head cut readlink greadlink which; do
for util in bash head cut readlink greadlink; do
if [ -x "${found}/$util" ]; then if [ -x "${found}/$util" ]; then
ln -s "${found}/$util" "${alt}/$util" ln -s "${found}/$util" "${alt}/$util"
fi fi

Loading…
Cancel
Save