[Openmcl-devel] Got it (was: Capturing output from shell command)

pekka pekka.niiranen at pp5.inet.fi
Mon May 14 14:54:20 PDT 2012

Forget it,

I managed to solve the problem with the following code:

(defun main (args)
   (if args
       (format t "~&Arguments were: ~a" args))
   (system "ls" "-n")

(defun system (cmd &optional args)
       (istream (with-output-to-string (ostream)
         (run-program cmd (list args) :output ostream)))
     (copy-stream istream)))

(defun copy-stream (in)
   (loop for line = (read-line in nil nil)
        while line
        do (format t "~%~a" line)))

(let ((args ccl:*unprocessed-command-line-arguments*))
   (main args))



More information about the Openmcl-devel mailing list