[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Non-blocking read from sub-process?
- From: Dan Christian <danchristian65@...>
- Date: Tue, 5 Apr 2016 17:32:58 -0700
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).
Something like:
f = io.popen(unknown_command, "r")
while im_doing_something_else:
data = f:read()
if data:
print ("Subproc says: ", data)
kill(sub_proc)
Thanks,
Dan