chickadee » posix » process

process COMMANDLINEprocedure
process COMMAND ARGUMENT-LIST #!optional ENVIRONMENT-LISTprocedure

Creates a subprocess and returns three values: an input port from which data written by the sub-process can be read, an output port from which any data written to will be received as input in the sub-process and the process-id of the started sub-process. Blocking reads and writes to or from the ports returned by process only block the current thread, not other threads executing concurrently.

Standard error for the subprocess is linked up to the current process's standard error (see process* if you want to reify its standard error into a separate port).

  • The single parameter version passes the string COMMANDLINE to the host-system's shell that is invoked as a subprocess.
  • The multiple parameter version directly invokes the COMMAND as a subprocess. The ARGUMENT-LIST is directly passed, as is ENVIRONMENT-LIST.

Not using the shell may be preferrable for security reasons.

Once both the input- and output ports are closed, an implicit waitpid(3) is done to wait for the subprocess to finish or to reap a subprocess that has terminated. If the subprocess has not finished, waiting for it will necessarily block all executing threads.