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 library depends on the acceptance of SettingsListsCowan.
Procedures
(open-input-process filename)
(open-output-process filename)
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 following keys:
- path
- The system command to be executed.
- 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, or a port (it is an error if the port has no OS-level underpinnings). 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, or a port (it is an error if the port has no OS-level underpinnings). If this key is absent, no redirection is done.
- stderr-redirection
- A string representing the file to open and pass to the new process as its standard error, or a port (it is an error if the port has no OS-level underpinnings). If this key is absent, no redirection is done.