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:33:19 +0100, Stephane Chazelas:
> 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.
[...]

See: https://www.zsh.org/mla/workers/2002/msg00158.html

A04redirect.ztst still has:

  print foo >&-
0:'>&-' redirection

  (exec >&-
  print foo)
0:'>&-' with attempt to use closed fd
*?\(eval\):2: write error:*

That is "print" with stdout explicitely closed meant to return
success and report no error message, but "print foo" without
explicit closing outputs an error (but exit status still 0).

So it seems to work as intended, though I'm not sure what the
rationale is for that intended behaviour.

-- 
Stephane




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