Skip to content
This repository

(RUN program args &KEY input if-input-does-not-exist output if-output-exists error if-error-exists environment replace-environment-p) => result-code

Runs the specified program in an external (Unix) process, blocking the Lisp thread, and returns the exit status of the process once completed.

INPUT, OUTPUT, and ERROR all behave similarly, accepting one of the following values:

  • NIL, specifying that a null stream (e.g., /dev/null) should be used;
  • T, specifying that the EXTERNAL-PROCESS should use the source or destination with which the Lisp was invoked;
  • a stream;
  • a pathname designator, to redirect to/from a file; or
  • :OUTPUT, (only available for ERROR) which directs the error output to the same destination as OUTPUT.

ENVIRONMENT contains an alist mapping vars to values.

REPLACE-ENVIRONMENT-P indicates whether the argument passed as ENVIRONMENT should replace or extend the current environment. The default is NIL (to extend the environment).


(START program args &KEY input if-input-does-not-exist output if-output-exists error if-error-exists environment replace-environment-p status-hook) => process

START works very much like RUN, except that it runs in the background and immediately returns a PROCESS object that can be queried for the streams involved, as well as the current status of the process. All of the remaining functions are only applicable to the return value of START.

The parameters differ from RUN as follows:

  • :STREAM, which creates a new stream opened for character input or output (accessible via the EXTERNAL-PROCESS-*-STREAM functions), is another option for input, output, and error; and
  • STATUS-HOOK is a function the system calls whenever the status of the process changes. The function takes the process as an argument.


(PROCESS-P object)

Returns T if object is a process, NIL otherwise.


(SIGNAL-PROCESS process signal)

Sends the specified unix signal to the specified external process. Signals an error if unsuccessful. The signal may be either an integer, or one of the keywords in EXTERNAL-PROGRAM::*SIGNAL-MAPPING*.


(PROCESS-ID process)

Returns the process id assigned to the external process by the operating system. This is typically a positive, 16-bit number.


(PROCESS-INPUT-STREAM process)

Returns the stream created when the input argument to START is specified as :STREAM.


(PROCESS-OUTPUT-STREAM process)

Returns the stream created when the output argument to START is specified as :STREAM.


(PROCESS-ERROR-STREAM process)

Returns the stream created when the error argument to START is specified as :STREAM.


(PROCESS-STATUS process)

Returns, as multiple values, a keyword denoting the status of the external process (one of :RUNNING, :STOPPED, :SIGNALED, or :EXITED), and the exit code or terminating signal if the first value is other than :RUNNING.

Something went wrong with that request. Please try again.