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

Re: [BUG] zsh dies in case of EIO with echo in .zlogout / ENOTTY



On 2021-07-12 13:13:20 +0100, Peter Stephenson wrote:
> That's equivalent to this:
> 
> % cat source.zsh
> exec 2>&-
> echo Exiting2 >&2
> echo Exiting
> % ./zsh
> % . ./source.zsh
> <no output>
> %
> 
> The inability to write to stderr to report the error writing to stderr
> (I think, so not the original error on the *request* to write to stderr,
> the fact it couldn't report the error) is treated as a hard error and causes
> the sourced script to fail at that point.
> 
> Not sure what the right answer is.  We've also been looking at complaints that
> zsh doesn't take errors with echo seriously enough...

I'd say that returning with a non-zero exit status is sufficient.
If the user wants the script to terminate after an error, he can
test the exit status or use "set -e". I don't see why the fact
that echo is a builtin should be treated differently.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




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