[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: PATCH: file:close() return-value for pipes
- From: David Favro <lua@...>
- Date: Sat, 12 Feb 2011 08:56:51 -0500
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
So I made another patch, implementing Sam's idea for the return-values, I
will send it along. Also changed the use of the WIF* macros to be
conditionalized on LUA_USE_POSIX rather than LUA_USE_LINUX, and removed all
references to __linux__.
> Returning the signal name as a string instead of a number would be
> more lua-ish, but converting signal numbers to strings is perhaps not
> so portable. Maybe the POSIX signals can have strings and any other
> signal number would just be a string of the number.
I agree that would be nicer, but perhaps storing the signal names as static
strings would add to the executable size for a relatively rare situation
(child death by signal).
-- David Favro