I having some trouble with system calls using clojure (actually a
whole lot more than that but this is the current day's difficulty).
Below, test-execute works, but get-msms-pts-OSX seems to hang, as in
nothing happens and the REPL is unresponsive afterwards.  If I run the
output of the (str *******) commands below in a terminal it works
fine.

I copied execute from here:

http://www.magpiebrain.com/2010/06/20/executing-a-command-line-program-with-clojure/

Thanks!

-Dave


*********************************************

(ns msms
  (:gen-class)
  (:use [clojure.contrib.duck-streams :only (read-lines)]))

(defn execute [command]
  (let [process (.exec (Runtime/getRuntime) command)]
    (if (= 0 (.waitFor  process))
        (read-lines (.getInputStream process))
        (read-lines (.getErrorStream process)))))

(defn test-execute [ls-arg]
  (execute (str "ls " ls-arg)))

(defn get-msms-pts-OSX
  ;; Finds the msms points for a density (optional DEFAULT = 1.0) and
radius (optional DEFAULT = 1.5)
  [pdb-file density radius]
  (execute (str "pdb_to_xyzr " pdb-file
                " > /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold.xyzr"))
  (execute  (str "msms.MacOSX.2.6.1"
                 " -if /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold.xyzr"
                 " -of /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold -
no_header -density "
                 density " -probe_radius " radius))
  (execute (str "rm -f /Users/daviddreisigmeyer/lisps/clojure/dpa/src/
hold.xyzr"
             " /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold.face")))

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to