Frage

I've written a program to assemble .dot files, and want to use Clojure's sh to give a compile command. Specifically, I use the following function to do it:

(defn compile-graphviz
  "Dumps graphviz-string to a file, then compiles it using dot."
  [graphviz-string]
  (do
    (spit "./tree.dot" graphviz-string)
    (sh "dot -Tpng \"/.tree.dot\" -o\"/.tree.png\"")))

However, when I run this, the second part fails, giving the following error message at the REPL:

IOException error=2, No such file or directory  java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2)

I've looked at the documentation for sh and examples, and I can't understand why this wouldn't work. What am I missing?

War es hilfreich?

Lösung

According to the documentation, sh uses execve semantics:

(sh "dot" "-Tpng" "/.tree.dot" "-o" "/.tree.png")
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top