[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: can i both write & read a pipe?
- From: Jamie Webb <j@...>
- Date: Tue, 27 Jul 2004 23:38:48 +0100
On Wed, Jul 28, 2004 at 12:33:58AM +0300, Asko Kauppi wrote:
>
> It seems 'popen' is only read, or write, but not both.
> What I'm trying to do is like:
>
> echo blahblahblah | osascript | (catch output)
>
> That is, Lua would be both feeding in _and_ reading the output of the
> 'osascript' command (which runs AppleScript on OS X).
It's a limitation of the underlying popen() call. To do a
bidirectional pipe, you'll need to write a C function using pipe(),
fork(), dup2(), and execvp(). Then submit the result to lhf for
inclusion into lposix?
-- Jamie Webb