[plt-scheme] writing to subprocess's stdin and then...

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 17 11:15:32 EDT 2008

On Jun 17, Andrew Reilly wrote:
> Hi Eli,
> I'm glad that this topic came up, because I was playing with just
> these issues last weekend.  I had been using process rather than
> subprocess (so I had to make up some amusing string quoting to pass
> in complicated, space-containing file names),

There's the ---* versions of functions which get the executable and
arguments in Scheme, so you don't need to deal with any quoting.
(Except from Scheme strings, of course.)

> [...]
> The problem is that this produces an error at run-time:
> subprocess: expects type <file-stream-output-port> as 3rd
> argument, given: #<output-port>; other arguments were: #f #f
> #<path:/usr/local/bin/metaflac> "--export-tags-to=-" "some file
> name..."

Yes, DrScheme is an obvious example where the error/output ports are
redirected in Scheme.

> Should subprocess really be so picky?  I suppose that it has to be,
> because the unix process wants a real file descriptor.  The
> current-error-port in this case is that of the drscheme environment.
> Seems to work OK from mzscheme on the command line.

Exactly.  As for the pickiness -- that's exactly why there's the
scheme/system library -- it abstracts these details for you.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.