'env -i' clears the complete environment, including PATH. In that
case, on most platforms, when excuting commands without PATH being
set, /usr/bin and /bin are searched, e.g. on Linux:
$ strace env -i asdf |& grep asdf
execve("/usr/bin/env", ["env", "-i", "asdf"], 0x7ffc3e3c0890 /* 27 vars */) = 0
execve("/bin/asdf", ["asdf"], 0x55be2da090d0 /* 0 vars */) = -1 ENOENT (No such file or directory)
execve("/usr/bin/asdf", ["asdf"], 0x55be2da090d0 /* 0 vars */) = -1 ENOENT (No such file or directory)
write(2, "\342\200\230asdf\342\200\231", 10‘asdf’) = 10
Howver, this does not hold on every platform. E.g. on Cygwin, so
such fallback paths are searched:
$ strace env -i asdf |& grep asdf
37 25736 [main] env 3516 build_argv: argv[2] = 'asdf'
643 30373 [main] env 3516 find_exec: find_exec (asdf)
35 30408 [main] env 3516 find_exec: (null) = find_exec (asdf)
36 30444 [main] env 3516 spawnve: spawnve (, asdf, 0x10040B000)
‘asdf’ 199 53601 [main] env 3516 write: 10 = write(2, 0x10040B040, 10)
$ env -i zsh
env: ‘zsh’: No such file or directory
Therefore, we need to make sure that the default PATH is exported
from tests/test-highlighting.zsh.
This makes the tests more reproducable. In particular it avoids hiding
a WARN_CREATE_GLOBAL error when the dev happens to have defined that
variable in the environment (cf. next commit).
Fixeszsh-users/zsh-syntax-highlighting#262.
Currently, 'make quiet-test' uses Perl. However, since it is considered a development
tool rather than a user-facing tool, users and downstream packages needn't install Perl.
Furthermore, even this dev-only dependency may be dropped in the future.
The only difference between tests/tap-filter here and the one in the issue is using
a `cat` subshell v. using 'undef $/; <STDIN>'.
Change quoting to only quote the shell variable, not the make variable. This
allows the leading '~' to be unescaped for make's sh to expand.
Followup to b1619c0013.
test failure would not be reflected by the exit code of 'make'.
Setting a shell parameter in the left-hand side of a pipe is not visible to
commands after the pipe, because the left-hand side forks. (That's true both
in 'sh' used by 'make' and in 'zsh' that runs tests/test-highlighting.zsh, at
least on my system.) Therefore, move the colorizing hook to where it doesn't
interfere with setting the $something_failed (in tests/test-highlighting.zsh)
and $result (in Makefile) parameters.