Murga-Projects Forums

Full Version: possible to use io.popen?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

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

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