Up: Running Programs from Lisp   [Contents][Index]


2.14.1 Process Accessors

The following functions interface the process returned by run-program:

Function: extensions:process-p thing

This function returns t if thing is a process. Otherwise it returns nil

Function: extensions:process-pid process

This function returns the process ID, an integer, for the process.

Function: extensions:process-status process

This function returns the current status of process, which is one of :running, :stopped, :exited, or :signaled.

Function: extensions:process-exit-code process

This function returns either the exit code for process, if it is :exited, or the termination signal process if it is :signaled. The result is undefined for processes that are still alive.

Function: extensions:process-core-dumped process

This function returns t if someone used a Unix signal to terminate the process and caused it to dump a Unix core image.

Function: extensions:process-pty process

This function returns either the two-way stream connected to process’s Unix PTY connection or nil if there is none.

Function: extensions:process-input process
Function: extensions:process-output process
Function: extensions:process-error process

If the corresponding stream was created, these functions return the input, output or error fd-stream. nil is returned if there is no stream.

Function: extensions:process-status-hook process

This function returns the current function to call whenever process’s status changes. This function takes the process as a required argument. process-status-hook is setf’able.

Function: extensions:process-plist process

This function returns annotations supplied by users, and it is setf’able. This is available solely for users to associate information with process without having to build a-lists or hash tables of process structures.

Function: extensions:process-wait process &optional check-for-stopped

This function waits for process to finish. If check-for-stopped is non-nil, this also returns when process stops.

Function: extensions:process-kill process signal &optional whom

This function sends the Unix signal to process. Signal should be the number of the signal or a keyword with the Unix name (for example, :sigsegv). Whom should be one of the following:

:pid

This is the default, and it indicates sending the signal to process only.

:process-group

This indicates sending the signal to process’s group.

:pty-process-group

This indicates sending the signal to the process group currently in the foreground on the Unix PTY connected to process. This last option is useful if the running program is a shell, and you wish to signal the program running under the shell, not the shell itself. If process-pty of process is nil, using this option is an error.

Function: extensions:process-alive-p process

This function returns t if process’s status is either :running or :stopped.

Function: extensions:process-close process

This function closes all the streams associated with process. When you are done using a process, call this to reclaim system resources.


Up: Running Programs from Lisp   [Contents][Index]