lua-users home
lua-l archive

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


"ms2008vip" <ms2008vip@gmail.com> wrote

> Has anybody any experience (or advice / where we should look) with this? or give me a sample? Thanks

You can use the Good Old Unix Way: pipe() + fcntl() + fork() + dup2() +
execve(), all provided by Lua-posix. The basic idea is described in [1]
and you can read the data with posix.read() and may also need a poll()
loop if you want to multiplex the readings. I wrote something like this
sometime ago, but I have no code at hand now.


[1] http://stackoverflow.com/questions/1735781/non-blocking-pipe-using-popen

-- 
Alexandre Erwin Ittner - alexandre@ittner.com.br
OpenPGP pubkey 0x0041A1FB @ http://pgp.mit.edu