run-process creates a new process and run the executable
specified in command . The p correspond to the command line
arguments. The following values of p have a special meaning:
:input permits to redirect the standard input file of the
process. Redirection can come from a file or from a pipe. To redirect
the standard input from a file, the name of this file must be
specified after :input . Use the special keyword :pipe to
redirect the standard input from a pipe.
:output permits to redirect the standard output file of the
process. Redirection can go to a file or to a pipe. To redirect
the standard output to a file, the name of this file must be
specified after :output . Use the special keyword :pipe to
redirect the standard output to a pipe.
:error permits to redirect the standard error file of the
process. Redirection can go to a file or to a pipe. To redirect
the standard error to a file, the name of this file must be
specified after error . Use the special keyword :pipe to
redirect the standard error to a pipe.
:wait must be followed by a boolean value. This value
specifies if the process must be run asynchronously or not. By
default, the process is run asynchronously (i.e. :wait is #f ).
:host must be followed by a string. This string represents
the name of the machine on which the command must be executed. This
option uses the external command rsh . The shell variable
PATH must be correctly set for accessing it without specifying its
abolute path.
:fork must be followed by a boolean value. This value
specifies if a fork system call must be done before running
the process. If the process is run without fork the Scheme
program is lost. This feature mimics the "exec " primitive of the
Unix shells. By default, a fork is executed before running the process
(i.e. :fork is #t ). This option works on Unix implementations only.
The following example launches a process which executes the
Unix command ls with the arguments -l and /bin . The lines
printed by this command are stored in the file /tmp/X
(run-process "ls" "-l" "/bin" :output "/tmp/X")
|