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

PATCH: Re: return command's exit code from _call



Bart Schaefer wrote:
> 
> The exit value of a function is supposed to be the exit value of the last
> command that it executed.  That is, "return $?" should be unnecessary; if
> $? has the right value to begin with, that's what should be returned by
> default.

I sort-of knew that somewhere at the back of my mind but I wasn't sure
if the last command would be the if statement or the eval command?

> So if this patch really changed the behavior, then there's another bug
> somewhere else (perhaps in the wordcode executor for if/else/fi?).

Oops, this is my fault for being too hasty and too stupid. The problem
is that the redirection of stderr had been lost and was nothing to do
with the exit code. The exit code was my first guess because that was
what the problem was last time. It appeared to fix the problem, because
the first time, I ran it, it produced the error message, I reloaded
_call and it worked properly but that was because _cache_groups had now
been set.

The patch fixes _groups. I'll also correct _call.

Sorry about that

Oliver

Index: Completion/User/_groups
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_groups,v
retrieving revision 1.3
diff -r1.3 _groups
10c10
<         tmp=$(_call groups ypcat group.byname); then
---
>         tmp=$(_call groups ypcat group.byname 2>/dev/null); then



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