lua-users home
lua-l archive

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


On 7/5/07, Duck <duck@roaming.ath.cx> wrote:
...but does anyone have either a patch or a package which implements a
bidirectional popen()? One which allows not just "r" xor "w" like the
standard version, but also "rw" so that I can use the file handle it
returns to push data into and get data out of the stdin/stdout of the
subprocess?

Oh, and which is portable between at least Linux and Windows, if not also
OS X and the BSDs?

Once again, I must plug the "ex" API at
http://lua-users.org/wiki/ExtensionProposal .

Please have a look at the popen2() example on that page.  It's
implemented with io.pipe() and os.spawn(), both of which are provided
by Lua installations which provide the "ex" API.

The source code to the reference implementation is available on the
wiki, but an updated version will be available at
http://luaforget.net/projects/lua-ex as soon as the friendly luaforge
admins respond to my repository upload request ... ;)

    -Mark