[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Controlling output of processes
From: |
Lasse Kliemann |
Subject: |
Re: [Chicken-users] Controlling output of processes |
Date: |
Fri, 12 Mar 2010 19:30:34 +0100 |
* Message by -Peter Bex- from Fri 2010-03-12:
> On Fri, Mar 12, 2010 at 05:14:02PM +0100, Lasse Kliemann wrote:
> > How can I start a process and control where it sends its stdout
> > or stderr? I know that I can do:
> >
> > (receive
> > (p-stdout p-stdin p-pid p-stderr)
> > (process* command args)
> > (...))
> >
> > This gives input and output ports connected to the process. But
> > how can I express, e.g.: "everything available on port p-stdout
> > should go to (current-output-port)"?
> >
> > Can you give me some suggestions?
>
> (receive
> (p-stdout p-stdin p-pid p-stderr)
> (process* command args)
> (with-input-from-port p-stdin (lambda () ....)))
>
> See http://chicken.wiki.br/man/4/Unit%20ports
Hello Peter, thank you for the answer. I tried it out, but it
does not work like the thing I wanted. Here is an example:
(receive
(p-stdout p-stdin p-pid p-stderr)
(process* "ls" '("-l"))
(with-input-from-port p-stdout (lambda () (process-wait p-pid))))
When I run this, I receive no output. The goal was that my
program hands the output of "ls -l" through. So this program was
supposed to give exactly the output of "ls -l". You know what I
mean?
(I replaced "p-stdin" by "p-stdout" in the call to
"with-input-from-port" because this looked more appropriate to
me, but it also does not work when I use "p-stdin" there, as your
example suggested.)
I hope there is a way to do it.
pgpySOJivXFnS.pgp
Description: PGP signature