lua-users home
lua-l archive

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


I'm not sure I see a benefit to it being a second return. Nil is false and all numbers are true so existing functionality should remain in tact.

However both implementation methods are arguable.
------Original Message------
From: Patrick Donnelly
Sender: lua-bounces@bazar2.conectiva.com.br
To: Lua list
ReplyTo: Lua list
Subject: Re: Feature request for 5.2; make exit codes from popen()ed programs obtainable
Sent: Sep 1, 2009 9:16 PM

On Tue, Sep 1, 2009 at 4:37 PM, Rob Kendrick<lua-l@nun.org.uk> wrote:
> Hi,
>
> Currently in Lua, it appears as if it is impossible to obtain the exit
> code of a program that you have opened with io.popen(); the close
> method on the returned object only returns true.
>
> Are there reasons for it not return this?  If not, can I request it be
> considered for 5.2?

This has been discussed [1]. There were some hacks proposed for
obtaining the status code in that thread. It would be nice if popen
returned the status code. I feel it should be a second argument,
however, because popen may fail early with "nil, <failure string>".


-- 
-Patrick Donnelly

"Let all men know thee, but no man know thee thoroughly: Men freely
ford that see the shallows."

- Benjamin Franklin


Sent from my Verizon Wireless BlackBerry