This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see ProcessPortsCowan in WG2's repo for R7RS-large.

Process­Ports­Cowan

cowan
2010-09-30 01:37:38
1history
source

Process Ports

The procedures in this proposal start a new operating system process and return a binary port (remember, binary ports can do character I/O as well) connected to either the standard input (for an output port) or the standard output (for an input port) of the new process. There is no support for input/output process ports, though an implementation could add them as an extension.

This module depends on the acceptance of PortsCowan or something like it, as it uses the framework of that proposal.

Procedures

(open-input-process filename)

(open-output-process filename)

(call-with-input-process filename proc)

(call-with-output-process filename proc)

(with-input-from-process filename thunk)

(with-output-to-process filename thunk)

All of these are equivalent to the corresponding R5RS functions on file ports. If filename is a string, it is a shell command suitable for passing to shell-command. If it is a list, it is a settings list as described in PortsCowan. Implementations MUST support the keys described in PortsCowan (where path is the system command to be executed), plus the following additional keys:

arguments
A list of strings to be passed as the arguments of the command. If absent or (), no arguments are passed.
environment
An alist, mapping strings to strings, representing the environment variables to be passed to the new process and their values. If the same environment variable appears more than once, all occurrences except the first are ignored, as is usual when processing alists. If this key is absent, the current environment is passed. If this key is (), an empty environment is passed.
stdin-redirection
A string representing the file to open and pass to the new process as its standard input. If this key is absent, no redirection is done.
stdout-redirection
A string representing the file to open and pass to the new process as its standard output. If this key is absent, no redirection is done.