Re: sys:open-pipe, closing one way of :io
It is a little kludgey, but it does work without the need for
temporary files. I think
that unless someone shows me a way to close the components of the pipe
individually, This will be the method I use.
On Wed, 09 Feb 2005 17:37:20 +0100, Edi Weitz <edi@agharta.de> wrote:
> On Wed, 9 Feb 2005 10:24:06 -0500, Joshua Taylor <joshuaaaron@gmail.com> wrote:
>
> > Hello all, Im trying to use Argonne's otter via sys:open-pipe. I'm
> > working under LWL4.4 right now, but will also be getting to the Mac
> > side of things too. I've got otter on my default path, so something
> > like
> >
> >
> >> (let ((p (sys:open-pipe "otter" :direction :output)))
> > (loop for line in '("set(binary_res)."
> > "formula_list(usable)."
> > "all x (Man(x) -> Mortal(x))."
> > "Man(socrates)."
> > "end_of_list."
> > "formula_list(sos)."
> > "-Mortal(socrates)."
> > "end_of_list.") do
> > (write-string line p))
> > (finish-output p)
> > (close p))
> >
> > will cause otter to output all the correct output to the xterm from
> > which I started lispworks. If I use "otter > temp.otter.out" rather
> > than "otter", I get the correct results in the temp file.
> >
> > The problem is, rather than reading from file, I'd prefer to just
> > read from a pipe. So I specify :direction :io. In that case,
> > however, I can't just (close p), because I do need to read from p
> > (to get the output). Otter doesn't seem to start doing anything
> > until its input is closed. (normally I invoke it as "otter <
> > input.in"). Is there a way to close just my output (otter's input)
> > side of the system::pty-stream that is returned by sys:open-pipe ?
>
> I had a similar problem when porting ASDF-INSTALL to LW and came up
> with a kludge like this:
>
> (sys:open-pipe (format nil "echo '~A' | otter"
> otter-commands)
> ...
>
> Does that help in your case? Maybe with "echo -e" instead of "echo"
> if needed?
>
> If it works it's still a kludge, though. I'd be very happy if
> OPEN-PIPE offered the option to get separate streams as in CMUCL,
> SBCL, or AllegroCL.
>
> Cheers,
> Edi.
>
>
--
=====================
Joshua Taylor
tayloj@rpi.edu