[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io.popen (and close)
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 17 Apr 2006 15:51:00 -0300
> I know that io.popen is a poor stepchild---undocumented and unloved
> but useful on Unix platforms nevertheless. (Actually I notice that as
> of Lua 5.1 it is evern documented.) To make io.open even more useful,
> I would like to be able to get the exit status returned by pclose(3).
> I notice that the specification says only that file:close() returns
> a non-nil value on success. Would it be possible to change the
> specification (and implementation) so that if f = io.popen(...),
> then f:close() returns the exit status? What do the Lua team think?
I am not sure that the meaning of the value returned by pclose is
standard. Several man pages say only that -1 means error. But if
this status code is really spread and really useful, it should not be
difficult to change that for 5.2.