[Ecls-list] new user
Juan Jose Garcia Ripoll
lisp at arrakis.es
Tue May 23 02:41:04 UTC 2006
On Sun, 2006-05-21 at 15:18 +0200, Lelanthran Manickum wrote:
> I am trying to use (pipe-open "/bin/bash") but I'm
> not getting the results I expect. I expected it
> to work like the clisp (make-pipe-io-stream) function.
Sorry for the delay in answering. ECL's pipe-open is an old function
which is being deprecated. It has the problem that it opens a pipe in
only one direction: either you write to the program's input or you read
the program's output. This is a limitation of using popen().
Not so long ago we ported a function which is compatible to CMUCL's
run-program. The function signature is
(ext::run-program (command argv &key (input @':stream')
(output @':stream') (error @'t'))
As you see, you pass the name of the program, a list of arguments (each
argument being a string), and also select which streams you want to be
able to read from or write to.
An example which uses ImageMagik to read information from a JPG file:
(defun compute-image-height (filename)
(let ((pipe (si::run-program "identify"
`("-format" "%h" ,(namestring (truename filename)))
:input nil
:error nil)))
(prog1 (read pipe)
(read-line)
(close pipe))))
Regards,
Juanjo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20060523/980f3e9e/attachment.sig>
More information about the ecl-devel
mailing list