lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

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