diff --git a/test/suite/batpipe.sh b/test/suite/batpipe.sh index 4a4776c..d942b41 100644 --- a/test/suite/batpipe.sh +++ b/test/suite/batpipe.sh @@ -12,9 +12,18 @@ test:detected_bash_shell() { test:detected_fish_shell() { description "Test it can detect a fish shell." - - output="$(SHELL="fish" fish --login -c "$(batpipe_path)")" - grep '^set -x' <<< "$output" >/dev/null || fail "Detected the wrong shell for fish." + + # Note: We don't use bash's `-c` option when testing with a fake fish shell. + # Bash `-c` will automatically exec() into the last process, which loses the + # argv0 we intentionally named after a different shell. + + # Test detection via `*sh -l` parent process. + output="$(printf "%q" "$(batpipe_path)" | fish -l)" + grep '^set -x' <<< "$output" >/dev/null || fail 'Detected wrong shell when checking parent process args.' + + # Test detection via hypen-prefixed parent process. + output="$(printf "%q" "$(batpipe_path)" | SHIM_ARGV0='-fish' fish)" + grep '^set -x' <<< "$output" >/dev/null || fail 'Detected wrong shell when checking parent process.' } test:viewer_gzip() {