tests: fix path_without to handle /bin properly
I was seeing /bin being left. This patch fixes it by anchoring the search pattern with ':' on both sides.
This commit is contained in:
parent
c18a3f9042
commit
6296bf3f8b
@ -111,7 +111,7 @@ assert() {
|
|||||||
# but in which system utils necessary for rbenv operation are still available.
|
# but in which system utils necessary for rbenv operation are still available.
|
||||||
path_without() {
|
path_without() {
|
||||||
local exe="$1"
|
local exe="$1"
|
||||||
local path="${PATH}:"
|
local path=":${PATH}:"
|
||||||
local found alt util
|
local found alt util
|
||||||
for found in $(which -a "$exe"); do
|
for found in $(which -a "$exe"); do
|
||||||
found="${found%/*}"
|
found="${found%/*}"
|
||||||
@ -123,8 +123,9 @@ path_without() {
|
|||||||
ln -s "${found}/$util" "${alt}/$util"
|
ln -s "${found}/$util" "${alt}/$util"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
path="${path/${found}:/${alt}:}"
|
path="${path/:${found}:/:${alt}:}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
path="${path#:}"
|
||||||
echo "${path%:}"
|
echo "${path%:}"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user