[plt-scheme] v299: process* file args, paths, strings, and byte-strings

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Oct 19 21:02:31 EDT 2004

At Tue, 19 Oct 2004 18:33:08 -0400, Richard Cobbe wrote:
> I'm a little confused about exactly how process*, paths, strings, and
> byte strings all interact in v299, and I'm hoping someone can clarify.
> Here's the context:
> (for-each
>   (lambda (deb)
>     (let-values ([(stdin stdout pid stderr ctrl-proc)
>                   (process* "/sw/bin/dpkg" "-I" deb)])
>       ...))
>   (directory-list "/sw/fink/debs"))
> So, directory-list returns a list of paths, and process* expects string
> arguments.  I know about path->byte-string and path->string, but I'm not
> sure whether they all work together to give me the behavior I want. 

`path->string' should be right. Under Unix and Mac OS X, `process*'
will convert its arguments to bytes using the current locale's
encoding, and `path->string' converts the path to a string using the
current locale's encoding, so they're consistent.

It's possible to have a path that can't be expressed in the locale's
encoding. In that case, though, you wouldn't be able to type the
corresponding command in your shell (er, assuming that your shell uses
the locale encoding, which it probably does).


Posted on the users mailing list.