[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bidirectional io.open()...anyone got one?
- From: Javier Guerra Giraldez <javier@...>
- Date: Fri, 06 Jul 2007 21:32:54 -0500
Duck wrote:
Forgive my ignorance, but why do you need two pipes...in other words,
each pipe is an unidireccional channel between two ends; so you have to
give two endpoints (one of each pipe) to the process, and use the other
two to read and write.
what you're asking for could (in theory, i guess) would need sockets
(which are bidirectional). you creae a socket pair (using socketpair(),
of course), give one to the process creator and use the other to read/write
like this:
local sktA, sktB = socketpair()
local proc, err = os.spawn (stdio=sktB, ...)
-- use sktA to communicate
i don't know how hard would it be to make os.spawn accept a socket and
use it for both stdin and stdout...
--
Javier