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

Re: $(<nofile) doesn't set $? to non-zero



On Thu, 15 Mar 2018 07:12:04 +0000
Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> 2018-03-14 14:50:04 +0000, Peter Stephenson:
> > On Wed, 14 Mar 2018 14:42:48 +0000
> > Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:  
> > > Would it be worth doing some:
> > > 
> > >   	ret = readoutput(stream, qt);
> > > 	if (errno) {
> > > 	  zwarn("%e: %s", errno, s);
> > > 	  lastval = cmdoutval = 1;
> > > 	}
> > > 	return ret;
> > > 
> > > there (or something cleaner to avoid relying on errno)?  
> > 
> > The return value is the linked list as we're in the context of
> > substitution, not command execution, which isn't easy to change
> > without a complete rewrite.  
> [...]
> 
> Why not just pass the error as a return argument like in the
> patch below?

That should be more consistent, thanks.  I've committed it (minor
tweaks).

pws



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