On Mar 20, 2014, at 9:41 PM, gvim <gvi...@gmail.com> wrote:
> I'm not familiar with the Java standard library and didn't find anything 
> matching my question on Google so here goes. From my Clojure app I need to 
> call an executable written in C and parse the text output within my Clojure 
> app. What's the standard way to call an external process and read its output? 
> In Ruby I use:
> 
> ext = IO.popen '/path/to/file'
> ext.readlines.each {|line| process line}
> ext.close

(-> (clojure.java.shell/sh "/path/to/file")
    :out
    (clojure.string/split #"\n"))

See:
        
http://clojure.github.io/clojure/clojure.java.shell-api.html#clojure.java.shell/sh
and:
        
http://clojure.github.io/clojure/clojure.string-api.html#clojure.string/split

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to