Reputation: 61
I'm trying to call an external shell command in common-lisp, via SBCL's sb-ext:run-program.
Documentation about this run-program command, can be found here: http://sbcl.org/manual/index.html in the section 7.7.3 Running external programs
That page, does not contain examples. I figured out how to use it, by checking this page: stackoverflow examples for sb-ext:run-program
This is what I'm trying to do...
First, I define a variable for a parameter:
(defconstant *a-argument* "-lh")
Then I call a command:
(sb-ext:run-program "C:\\Program Files (x86)\\Gow\\bin\\ls.exe"
'(*a-argument*)
:output *standard-output*)
It gives me the following error:
debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {100299C8F3}>:
The value
*A-ARGUMENT*
is not of type
SEQUENCE
However, if I call it like this:
(sb-ext:run-program "C:\\Program Files (x86)\\Gow\\bin\\ls.exe"
'("-lh")
:output *standard-output*)
then it works. The only difference is using "-lh"
directly, instead of *a-argument*
.
So the question I have is:
What do I need to do, to make the run-program call work, with a variable in the parameter list?
Extra info:
windows32 2.6.1 7601 i686-pc Intel unknown MinGW
SBCL 1.3.8
But I also tested this on FreeBSD 10.1 and there I have the same problem.
Upvotes: 2
Views: 1043
Reputation: 61
The answer was given by jkiiski:
I needed to change this call:
(sb-ext:run-program "C:\\Program Files (x86)\\Gow\\bin\\ls.exe"
'(*a-argument*)
:output *standard-output*)
To this call:
(sb-ext:run-program "C:\\Program Files (x86)\\Gow\\bin\\ls.exe"
(list *a-argument*)
:output *standard-output*)
Upvotes: 4