[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: file:close() return-value for pipes
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 14 Feb 2011 16:42:41 -0200
> > On 02/11/2011 02:03 AM, Sam Roberts wrote:
> > > Me, I wouldn't do it by putting exit or signal number in the same
> > > return position, that seems ripe for confusion. I'd have pclose()
> > > return exit status if WIFEXITED, or "nil,signo" if WIFSIGNALLED.
> >
> > This seems like a good idea, although note that the first return value
> > already uses nil for certain error situations, but these are somewhat
> > esoteric and unlikely to occur in a lua program: see
> > http://pubs.opengroup.org/onlinepubs/9699919799/functions/pclose.html for
> > details.
>
> Wouldn't be better if the first result was what happened
> ("exit" x "signal") and the second result the actual exit code
> or signal number?
Better yet, it could return true for exit(0) and nil,what,code otherwise.
-- Roberto