test: Fix fish being incorrectly detected as installed

This commit is contained in:
Ethan P 2021-04-07 20:38:35 -07:00
parent e1a0c7a349
commit eee3156e8a
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA
2 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,7 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
while read -d ':' -r dir; do while read -d ':' -r dir; do
if [[ "$dir" == "$HERE" || -z "$dir" ]]; then continue; fi if [[ "$dir" == "$HERE" || -z "$dir" ]]; then continue; fi
if [[ -f "${dir}/fish" ]]; then if [[ -f "${dir}/fish" ]]; then
TMPDIR= "${dir}/fish" "$@" TMPDIR='' "${dir}/fish" "$@"
exit $? exit $?
fi fi
done <<<"$PATH:" done <<<"$PATH:"

View File

@ -13,6 +13,7 @@ test:detected_bash_shell() {
test:detected_fish_shell() { test:detected_fish_shell() {
description "Test it can detect a bash shell." description "Test it can detect a bash shell."
command -v "fish" &>/dev/null || skip "Test requires fish shell." command -v "fish" &>/dev/null || skip "Test requires fish shell."
fish -c 'exit 0' &>/dev/null || skip "Test requires fish shell." # This is in case it finds "fish" in shimexec dir.
output="$(SHELL="fish" fish --login -c "$(batpipe_path)")" output="$(SHELL="fish" fish --login -c "$(batpipe_path)")"
grep '^set -x' <<< "$output" >/dev/null || fail "Detected the wrong shell for fish." grep '^set -x' <<< "$output" >/dev/null || fail "Detected the wrong shell for fish."