John wrote:
> I did this:
>
> (import '(java.io BufferedReader InputStreamReader))
>
> (defn cmd [p] (.. Runtime getRuntime (exec (str p))))
>
> (defn cmdout [o]
>   (let [r (BufferedReader.
>              (.InputStreamReader.
>                (.getInputStream o)))]
>     (dorun (map println (line-seq r)))))
>
> Then:
>
> (cmdout (cmd "ls -a"))



The code above contains an error:

              (.InputStreamReader.

should be:

              (InputStreamReader.

Note one dot less. You are calling a constructor.

Otherwise works fine. Thanks for sharing.

Albert
-- 
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to