On Aug 7, 4:46 pm, Dave <david.dreisigme...@gmail.com> wrote:
>   (execute (str "/../pdb_to_xyzr " pdb-file " > /..")))
>
> Here it seemed to run (the above error isn't shown) but nothing
> happened and the REPL become unresponsive again.  

I think the issue is that Runtime.exec doesn't start a shell, just a
subprocess, so things that are normally handled by the shell (like
redirection and pipes) doesn't work.
On
(execute "env | grep PATH")
I get "env: |: no such file or directory" - pipes and redirections are
passed as arguments to the first command rather than being handled by
the shell.


> When I try:
>   (sh :in (str "/...pdb_to_xyzr" pdb-file " > /...hold.xyzr")))
> I get the following:
> No matching method found: exec for class java.lang.Runtime

:in is the "standard in" for a command, but you haven't specified
which command.

If you use "sh" as the command you get a shell and can use normal
shell syntax for the :in parameter.

So this works:
user=> (sh "sh" :in "env | grep PATH")
"PATH=/usr/bin:/bin:/usr/sbin:/sbin\n"
user=> (sh "sh" :in "env > tmp.txt")
""


> Does anyone know why this doesn't seem to work:
>
> (defn test-execute [ls-arg1 ls-arg2]
>   (execute (str "ls -" ls-arg1))
>   (execute (str "ls -" ls-arg2)))

As far as I can tell it does - it executes both commands, but returns
only the result of the last one.
If you want both, wrap them in a list or vector:
(defn test-execute [ls-arg1 ls-arg2]
  (list
    (execute (str "ls -" ls-arg1))
    (execute (str "ls -" ls-arg2))))


Regards
jf

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