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

Re: [BUG] builtin echo doesn't check write error



2021-06-09 16:17:30 +0200, Vincent Lefevre:
> On 2021-06-09 16:09:40 +0200, Vincent Lefevre wrote:
> > With zsh 5.8, the builtin echo doesn't check write error.
> 
> And that's also the case for "print", "printf" and maybe others.
[...]

It looks as if EBADF is treated specially on purpose. Errors are
reported for ENOSPC for instance:

$ zsh -c 'echo asd >> mnt/a; echo $?'
zsh:echo:1: write error: no space left on device
1


For print and printf to fail with an error upon EBADF, you can do:

print -u1 -- Sstring
print -u1 -f "$format" -- ...

-- 
Stephane




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