Find (s)testr more reliably
We have seen instances where type -p (s)testr seems to return with a leading blank line which confuses ansible later when trying to use the first line of output as the path to (s)testr. Address this by chomping with grep -v ^$. Additionally use type -P instead of -p to ensure we always get a path even when the command may be an alias or builtin. Change-Id: Ibffe1e1499eca18ef5dc3904fe222a55242b827d
This commit is contained in:
parent
7bd7aa5c9a
commit
ce31c2c678
@ -62,7 +62,11 @@ if [[ -d .tox ]] ; then
|
||||
fi
|
||||
|
||||
for command in $commands; do
|
||||
found=$(type -p $command)
|
||||
# Use -P instead of -p because we always want a path here even if
|
||||
# there is an alias or builtin. We also filter blank lines as we
|
||||
# only want lines with paths and in some cases type seems to produce
|
||||
# blank lines.
|
||||
found=$(type -P $command | grep -v ^$)
|
||||
if [[ -n $found ]] ; then
|
||||
echo $found
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user