News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
possible to use io.popen?
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Question  possible to use io.popen?

Lua has this handy alternative to os.execute which grabs the output of a shell command:

mycmd = io.popen("some_command")
myoutput = mycmd:read("*a")
mycmd:close()

Is this possible with MurgaLua? If not, is there something similar which doesn't require writing the command's output to a file and then parsing the file?

Thanks for reading.

04-26-2007 03:41 PM
Find all posts by this user Quote this message in a reply
JohnMurga
Administrator
*******


Posts: 381
Group: Administrators
Joined: Apr 2007
Status: Offline
Reputation: 2
Post: #2
RE: possible to use io.popen?

mikshaw Wrote:
Lua has this handy alternative to os.execute which grabs the output of a shell command:

mycmd = io.popen("some_command")
myoutput = mycmd:read("*a")
mycmd:close()


Hi mikshaw !

I did some research and it turns out that this is disabled when you build Lua in ANSI mode (for compatibility), however popen works on the three platforms I am interested in so I have tweaked the build and it'll be available along with a couple of other things when I update 0.4 (this week?).

Cheers
JohnM

04-26-2007 07:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #3
RE: possible to use io.popen?

Thank you! I know there will be other people pleased with this feature as well.

04-27-2007 02:48 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: