[plt-scheme] subprocess and wait

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Feb 26 10:00:42 EST 2006

At Sun, 26 Feb 2006 14:49:36 +0000, "Paulo J. Matos" wrote:
> > If so, you need to read all the data from the subprocess's stdout as
> > its running, or you need to redirect the subprocess's stdout to a port
> > that holds arbitrary amounts of data. For example, you might call
> > `make-pipe' (with no arguments or with #f for the `limit-k' argument),
> 
> By doing this I get:
> subprocess: expects type <file-stream-output-port> as 1st argument,
> given: #<output-port:pipe>; other arguments were: #f
> #<output-port:pipe> "/home/pmatos/solvers/...
> "/home/pmatos/satlib/U...

I forgot how the layers go.

Maybe `process' from `(lib "process.ss")' will be easier to use, since
it handles arbitrary ports.

Or create a thread to copy the subprocess stdout to a pipe while you
wait:

 (thread (lambda ()
           (copy-port stdout-in pipe-out)
           (close-output-port pipe-out)))

Matthew



Posted on the users mailing list.