lua-users home
lua-l archive

Re: Non-blocking read from sub-process?

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


Thank you. That was exactly what I needed!
I did re-write the first function to not depend on your stuff (in case
anyone else wants it).
#!/usr/bin/env lua
local posix = require('posix')
local data = string.rep("a",72) .. "\n"
for i = 1 , 5 do
 local my_time = posix.time()
 io.stdout:write(my_time .. data)
 io.stdout:flush()
 posix.sleep(1) -- delay 1 second
end
Thanks again,
Dan
On Tue, Apr 5, 2016 at 7:31 PM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Dan Christian once stated:
>> I want to run a sub-process that may or may-not generate output. How
>> can I make sure I don't block trying to read it. I'm happy to use
>> luaposix, but I'm trying not to use a big event framework like lua-ev
>> (because I'm memory limited and also don't want to cross compile it).

AltStyle によって変換されたページ (->オリジナル) /