lua-users home
lua-l archive

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


Hi Mark,
 sorry for not saying that before, given the bug I wrote of in the
wiki (which I see you have solved), I could not wait and implemented
the big parts of the API by scratch. Reimplementation is POSIX only,
and differs from you proposal for a few things.

I put a link on the wiki page to my observations. I've also put the
code in the wiki, just for completeness (I know it could be annoying
if someone jumps in and says "you should...").

The things I found useful to change are just a few, sometimes I just
sticked to the behaviour you described and reimplemented only not to
mix the two codes.

I'd be glad to know what you think of that.

--mi


On 06/07/07, Mark Edgar <medgar123+lua-l@gmail.com> wrote:
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