[plt-scheme] subprocess and wait

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Sun Feb 26 09:49:36 EST 2006

On 26/02/06, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Sun, 26 Feb 2006 10:38:42 +0000, "Paulo J. Matos" wrote:
> > I've have created a program in PLT Scheme, whose main objective is to
> > gather a bunch of other programs and run them accordingly a specified
> > algorithm which depends on their output. To run them I create a
> > subprocess and then right after I do a subprocess-wait.
> > After waiting returns I'll parse the huge output in search for a specific
> > token.
> The buffer between MzScheme and the subprocess's stdout has a limited
> size. If you don't read anything from subprocess's stdout, then the
> subprocess will eventually not be able to write any more data, so it
> will pause. Is that the problem?
> 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/...

Is there a way to convert between these output ports?

> and use the resulting output port for the subprocess's stdout; since
> the pipe's buffer is not limited, it will catch all of the subprocess's
> data, and you can read it later.
> Matthew

Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering

Posted on the users mailing list.