Re: executing shell command

2008-08-31 Thread Albert Cardona
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

Re: executing shell command

2008-08-26 Thread John
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 (cm

Re: executing shell command

2008-08-26 Thread Stuart Sierra
Launching shell commands from Java is a nuisance. Commons Exec helps a little bit: http://commons.apache.org/exec/ -Stuart Sierra On Aug 25, 8:00 am, Parth Malwankar <[EMAIL PROTECTED]> wrote: > I want to run a shell command through Clojure > so I tried the following which doesn't work: > > user

Re: executing shell command

2008-08-25 Thread Parth Malwankar
On Aug 25, 5:45 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Here's one I wrote probably needs revisited > > (defn doCmd >         "do any command" >         ([& params] >                 (let [cmd (new java.util.ArrayList)] >                         (doseq atom params >                

Re: executing shell command

2008-08-25 Thread [EMAIL PROTECTED]
Here's one I wrote probably needs revisited (defn doCmd "do any command" ([& params] (let [cmd (new java.util.ArrayList)] (doseq atom params (let [#^String prms (. atom split " ")]

Re: executing shell command

2008-08-25 Thread Stuart Cook
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 PRO

Re: executing shell command

2008-08-25 Thread Michael Reid
Hi Parth, On 8/25/08, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > I want to run a shell command through Clojure > so I tried the following which doesn't work: > By "doesn't work" do you mean that you don't see any output from the processes? First thing to understand is that processes creat

executing shell command

2008-08-25 Thread Parth Malwankar
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