Reading from io.popen handle crashes in release build Lua
2012-07-08 13:12:08 GMT
I have this bit of (what I think is) innocuous Lua code:
local f = assert(io.popen(path .. " -version", 'r'))
local s = assert(f:read('*a'))
Where "path" is a string pointing to a configuration program, and I do some processing on "s" afterwards to make sure it's at the correct version before proceeding.
This worked fine in Lua 5.1.5, and it works fine when I build Lua 5.2.1 in debug mode, but when I have a release version of the lua executable, it crashes on the second line with "Interrupted system call."
I'm not sure which optimization in my particular Release configuration is causing the issue, but I figured it worth asking if anyone had an idea of what might cause a problem like this, what might have changed in io between 5.1 and 5.2, etc.
Is there a new, better way to get the output from an external program?