CLISP ext:execute

Discussion of Common Lisp
Post Reply
proton1
Posts: 1
Joined: Wed Nov 19, 2014 2:27 am

CLISP ext:execute

Post by proton1 » Wed Nov 19, 2014 2:41 am

Hi, I am trying to execute an external program from CLISP on a Mac, but I am stuck. Does anybody have examples on how to use ext:execute or ext:run-program. What is the difference between the two (and also ext:run-shell-command). I find the documentation at http://www.clisp.org/impnotes/shell.html too confusing for a newbie like me.
In particular, I am trying to unzip a file to a given destination directory. I don't need portability, because I will be using it only with CLISP running on a Mac OS X.
I have tried (among many other things)

(ext:run-program "unzip zipfile.zip -d destinationdir/")

and I get

/bin/sh:/Users/User/unzip zipfile.zip -d destinationdir/: Cannot execute: no such file or directory

The zipfile.zip and destinationdir both do exist, I have also tried giving the absolute path to the files, so I suspect it is the unzip application that is not found.

Can anyone shed some light on this? Thank you very much!

aidlt
Posts: 19
Joined: Thu May 16, 2013 1:42 pm

Re: CLISP ext:execute

Post by aidlt » Thu Nov 20, 2014 10:02 am

Actually you should try and use UIOP, a portable wrapper for OS-related functionality. It is a part of ASDF3 and should be available out of the box (you could also check if your *features* have ASDF3). The command would be then

Code: Select all

(uiop:run-program "unzip zipfile.zip -d destinationdir/")
UIOP's documentation is mostly available as docstrings, e. g. here:
https://github.com/fare/asdf/blob/maste ... ogram.lisp

Post Reply