I've added shell-out to clojure-contrib, with an 'sh' function that
allows usage like:

user=> (use '[clojure.contrib.shell-out :only (sh)])
nil
user=> (print (sh "ls" "-l"))
total 1316
drwxrwxr-x 5 chouser chouser    4096 2008-12-16 11:32 classes
drwxrwxr-x 3 chouser chouser    4096 2008-12-02 11:46 clj
nil
user=> (print (sh "sed" "s/[aeiou]/oo/g" :in "hello there\n"))
hoolloo thooroo
nil

It also has options for choosing the character encoding or returning
stdout and stderr as an array of bytes to deal with binary data.

What it does not provide is any kind of asynchronous interaction -- no
passing of IO streams to or from the function.  I will certainly
consider adding these if there's enough demand, but that kind of
interaction significantly complicates the API.  I'd rather serve 80%
of use cases with a dead-simple API and let the other 20% deal with
the Runtime and Process classes themselves.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to