문제

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?

도움이 되었습니까?

해결책

According to the documentation, sh uses execve semantics:

(sh "dot" "-Tpng" "/.tree.dot" "-o" "/.tree.png")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top