Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh silently abandons compound command on trying to write to a closed file descriptor



zsh misbehaves if a redirection produces an error due to writing to a
closed file descriptor. For instance,

    echo hi >&- || echo oops

doesn't output "oops" as expected. But the shell is not exited, only the
current compound command is apparently abandoned -- silently, without an
error message or even a non-zero exit status.

Test script:

	echo hi >&- || ! echo oops
	echo $?

'zsh test.sh' and 'zsh -o posixbuiltins test.sh' both output 0 (and
nothing else). Expected output is an error message followed by "oops"
followed by 1.

Relevant POSIX text is at:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01

Thanks,

- M.



Messages sorted by: Reverse Date, Date, Thread, Author