From a9e11ba164c4fb209c9b8ba66d99ed78526d7d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 11 Nov 2021 20:08:12 +0200 Subject: [PATCH] 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: https://salsa.debian.org/debian/debianutils/-/commit/3a8dd10b4502f7bae8fc6973c13ce23fc9da7efb , https://salsa.debian.org/debian/debianutils/-/commit/610a65c6ef040872a124576ddb504c2d4918e880 --- plugins/python-build/test/pyenv.bats | 4 ++-- test/test_helper.bash | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/python-build/test/pyenv.bats b/plugins/python-build/test/pyenv.bats index 8ed63207..4d228a65 100644 --- a/plugins/python-build/test/pyenv.bats +++ b/plugins/python-build/test/pyenv.bats @@ -183,7 +183,7 @@ OUT } @test "pyenv-install has usage help preface" { - run head "$(which pyenv-install)" + run head "$(command -v pyenv-install)" assert_output_contains 'Usage: pyenv install' } @@ -212,6 +212,6 @@ OUT } @test "pyenv-uninstall has usage help preface" { - run head "$(which pyenv-uninstall)" + run head "$(command -v pyenv-uninstall)" assert_output_contains 'Usage: pyenv uninstall' } diff --git a/test/test_helper.bash b/test/test_helper.bash index 30615cd3..a0fb24cb 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -116,12 +116,12 @@ path_without() { local path=":${PATH}:" for exe; do local found alt util - for found in $(PATH="$path" which -a "$exe"); do + for found in $(PATH="$path" type -aP "$exe"); do found="${found%/*}" if [ "$found" != "${PYENV_ROOT}/shims" ]; then alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')" 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 ln -s "${found}/$util" "${alt}/$util" fi