On Aug 25, 10:00 pm, Parth Malwankar <[EMAIL PROTECTED]>
wrote:
> I want to run a shell command through Clojure
> so I tried the following which doesn't work:
>
> user=> (.. Runtime (getRuntime) (exec "vim"))
> [EMAIL PROTECTED]
> user=> (.. Runtime (getRuntime) (exec "/usr/bin/vim"))
> [EMAIL PROTECTED]
> user=> (.. Runtime (getRuntime) (exec "ls"))
> [EMAIL PROTECTED]
>
> I may be doing something really silly here as I
> don't really know Java. Whats the right way to do this?

You've managed to successfully launch subprocesses, but it looks like
you're expecting exec to return a String, when in fact it returns a
Process.

If you want to get the subprocess's output, you'll need to call
getInputStream on the Process object, and extract the output from
there.

(Of course, there might be a library function that does everything for
you, but I'm not aware of any such function.)


Stuart

--~--~---------~--~----~------------~-------~--~----~
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