summaryrefslogtreecommitdiff
path: root/hacking
diff options
context:
space:
mode:
authorVincent Bernat <vincent@bernat.ch>2020-08-18 17:31:28 +0200
committerGitHub <noreply@github.com>2020-08-18 11:31:28 -0400
commit4afc228108e6d8155175e728cfed961017ae7b25 (patch)
treec6b1287a10b9c6dd879208e088c4b25b3c12253a /hacking
parentf2f6c3463234a59410e4d5bfe320dbff2490d9c4 (diff)
downloadansible-4afc228108e6d8155175e728cfed961017ae7b25.tar.gz
hacking: replace use of "which" with "command -v" (#71278)
"command -v" is the POSIX compliant way to get the path to a command. It returns the path to the command if it exists and exits with a non-zero status when it does not, without any output. "which" is not POSIX and it can have various different effects. With Zsh, it says "python not found" on stdout. See: - https://pubs.opengroup.org/onlinepubs/009695399/utilities/command.html Signed-off-by: Vincent Bernat <vincent@bernat.ch>
Diffstat (limited to 'hacking')
-rw-r--r--hacking/env-setup3
1 files changed, 2 insertions, 1 deletions
diff --git a/hacking/env-setup b/hacking/env-setup
index 46f58fecda..fc0648751a 100644
--- a/hacking/env-setup
+++ b/hacking/env-setup
@@ -1,3 +1,4 @@
+
# usage: source hacking/env-setup [-q]
# modifies environment for running Ansible from checkout
@@ -21,7 +22,7 @@ prepend_path()
PYTHONPATH=${PYTHONPATH-""}
PATH=${PATH-""}
MANPATH=${MANPATH-$(manpath)}
-PYTHON=$(which python 2>/dev/null || which python3 2>/dev/null)
+PYTHON=$(command -v python || command -v python3)
PYTHON_BIN=${PYTHON_BIN-$PYTHON}
verbosity=${1-info} # Defaults to `info' if unspecified