Reputation: 11764
I have this:
(import 'java.lang.Runtime)
(defn foo []
(println (.getOutputStream (. (Runtime/getRuntime) exec "pwd"))))
It successfully returns a java.io.OutputStream (java docs here: http://docs.oracle.com/javase/1.5.0/docs/api/java/io/OutputStream.html
How do I now write this stream using clojure/java interop? I want to get a string of the 'pwd' command.
Thanks
Upvotes: 1
Views: 143
Reputation: 501
This isn't the direct answer to the question, but thought it might be helpful to others to mention that https://clojuredocs.org/clojure.java.shell/sh would be helpful in this situation as well.
Upvotes: 1
Reputation: 6444
Maybe this is not the best way to get the current working directory. Take a look here: Getting the Current Working Directory in Java
Upvotes: 0