I'd like to get data from an output when a system command is finished in Lua,
even while that command may take a few minutes to an end.
Obviously popen executes the command separately from the lua process.
Does anyone has an idea to solve this?
r = popen('command','r')
for line in r:lines() do
print(line)
end
1 Answer 1
If the command uses buffered output (the default) then there's nothing you can do. Some commands (e.g., cat -u) have an option to use unbuffered output, but they're rare.
answered Jan 6, 2011 at 11:06
lang-lua