NextPrevUpTopContentsIndex

call-system

Function
Package

system

Signature

call-system command &key current-directory wait shell-type => status

Arguments

command

A string or a list of strings.

current-directory

A string. Implemented only on Windows.

wait

A boolean.

shell-type

A string. Implemented only on Unix/Linux/Mac OS X.

Values

status

The exit status of the invoked shell or process.

Description

call-system allows executables and DOS or Unix shell commands to be called from Lisp code. The output goes to standard output, as the operating system sees it. (This normally means *terminal-io* in LispWorks.)

If command is a string it is the command to execute. If command is a list or a simple-vector , the first element gives the command and the remaining elements are the command line arguments, and command is run directly, not via a subshell.

If you need to invoke the command interpreter on Windows then pass as command "cmd /c command" on NT or "command.com /c command" on Windows 9x.

On Windows current-directory is the lpCurrentDirectory argument passed to CreateProcess. If this is not supplied, the pathname-location of the current-pathname is passed.

If wait is true, call-system does not return until the process has exited. The default for wait is t .

On Unix/Linux/Mac OS X shell-type gives the type of shell required. The default is the Bourne shell, /bin/sh . The C shell may be obtained by specifying "/bin/csh" .

call-system returns the exit status of the shell invoked to execute the command on Unix/Linux/Mac OS X, or the process created on Windows.

Example

On Unix:

(call-system (format nil "adb ~a < ~a > ~a"
                (namestring   a)
                (namestring   b)
                (namestring   c)))

On Windows:

CL-USER 176 > sys:call-system "sleep 3" :wait t
0
See also

open-pipe
call-system-showing-output
run-shell-command


LispWorks Reference Manual - 6 Apr 2005

NextPrevUpTopContentsIndex