Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Shell from Common Lisp

Name: Anonymous 2011-01-03 23:43

I've following snippet, but it works only on SBCL/Unix. Please, point me to portable version.


(defun shell (command)
  ;; for ACL use (shell command)
  (let ((s (sb-ext:process-output
             (sb-ext:run-program "bash" (list "-c" command)
                                 :search t :input t :output :stream
                                 :wait t :pty nil)))
        (r nil))
    (block reading
      (loop (let ((it (read-line s nil nil)))
              (unless it (return-from reading))
              (push it r))))
    (nreverse r)))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List