NextPrevUpTopContentsIndex

call-system-showing-output

Function
Package

system

Signature

call-system-showing-output command &key current-directory prefix show-cmd output-stream wait shell-type kill-process-on-abort => status

Arguments

command

A string, a list of strings, a simple-vector of strings, or nil .

current-directory

A string. Supported only on Microsoft Windows.

prefix

A string.

show-cmd

A boolean.

output-stream

A symbol.

wait

A boolean.

shell-type

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

kill-process-on-abort

A generalized boolean.

Values

status

The exit status of the invoked shell or process.

Description

call-system-showing-output is an extension to call-system which allows output to be redirected. On Unix/Linux/Mac OS X this means it can be redirected to places other than the shell process from which the LispWorks image was invoked. call-system-showing-output therefore allows the user to, for example, invoke a shell command and redirect the output to the current Listener window.

The argument command is interpreted as by call-system.

prefix is a prefix to be printed at the start of any output line. The default value is "; " .

show-cmd specifies whether or not the cmd invoked will be printed as well as the output for that command. If t then cmd will be printed. The default value for show-cmd is t .

output-stream specifies where the output will be sent to. The default value is *standard-output* .

If wait is true, call-system-showing-output does not return until the process has exited. If nil , call-system-showing-output returns immediately and no output is shown. The default for wait is t .

shell-type is a string naming a UNIX shell. The default is "/bin/sh" .

If kill-process-on-abort is true, then when call-system-showing-output is aborted the process is killed. The default value of kill-process-on-abort is nil .

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

Examples

On Linux:

CL-USER 1 > (sys:call-system-showing-output "pwd" :prefix "***")
***pwd
***/amd/xanfs1-cam/u/ldisk/sp/lispsrc/v42/builds
0
 
CL-USER 2 > (sys:call-system-showing-output "pwd" :prefix "&&&" :show-cmd nil)
&&&/amd/xanfs1-cam/u/ldisk/sp/lispsrc/v42/builds
0

On Microsoft Windows:

CL-USER 223 > (sys:call-system-showing-output
                        "cmd /c type hello.txt"
                        :prefix "***")
***cmd /c type hello.txt
***Hi there
0
 
CL-USER 224 > (sys:call-system-showing-output
                        "cmd /c type hello.txt"
                        :prefix "&&&"
                        :show-cmd nil)
&&&Hi there
0
See also

call-system
open-pipe
run-shell-command


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex