Shell interface

Up: Kawa

Running commands

(run command arg ...)
The command is an executable program or script, and the arg are command line arguments. (For now leave it open if these evaluated or quoted.)

The result of standard output of the command is effectively redirected to a temporary file, and the contents of this file, viewed as a string or text object, becomes the result of the run expression. If the output consumer for the run is an output port then the command's standard output is re-directed to that port. In the initial case, the output consumer is the standard output stream of the containing JVM, so no redirection is needed.

The standard error output of the command is piped to the current error port. If the error port matches the initial error port, no re-direction is needed.

The standard input of the command is connected to the current input port of the dynamic context.

Discussion: An alternative is to define run so the output from the comm and is written to the current output port. One could then re-ify the output from a command with some kind of a with-output-to-string macro.

File name expansion

(glob regexp)

Return a set of Path values that match the regexp, as multiple values. The can be interpolated in a run argument list.