Question

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?

Was it helpful?

Solution

According to the documentation, sh uses execve semantics:

(sh "dot" "-Tpng" "/.tree.dot" "-o" "/.tree.png")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top