我已经编写了一个汇编.dot文件的程序,并希望使用Clojure的程序sh
来发出编译命令。具体来说,我使用以下功能来做到这一点:
(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\"")))
但是,当我运行此命令时,第二部分将失败,并在REPL上给出以下错误消息:
IOException error=2, No such file or directory java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2)
我看过文档中的sh
和示例,但我不明白为什么这行不通。我想念什么?
根据文档,sh
使用execve语义:
(sh "dot" "-Tpng" "/.tree.dot" "-o" "/.tree.png")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句