POSIX mandates that all elements in a pipeline are run in subshells, but permits extensions that run some or all of those elements in the main shell environment instead. zsh always runs the final element in a pipeline in the normal shell environment, which breaks programs which expect to conform to POSIX. For example, the Git testsuite fails in a variety of ways when zsh is /bin/sh. This behavior is fine as zsh, since in that case it's obvious that extensions are being enabled, but when "emulate sh" is set, the final element in a pipeline should also be run in a subshell for maximum compatibility with POSIX. As an example, the attached program should print "boo", "baz", and "foo", in that order when run under "zsh --emulate sh", but does not: ---- % dash foo.sh boo baz foo % zsh --emulate sh foo.sh boo baz baz ----