本文介绍了clojure.java.sh:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经编写了一个汇编.dot文件的程序,并希望使用Clojure的 sh
发出编译命令.具体来说,我使用以下功能来做到这一点:
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\"")))
但是,当我运行此命令时,第二部分失败,并在REPL上显示以下错误消息:
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)
我看过 sh
的文档和示例,但我不明白为什么这行不通.我想念什么?
I've looked at the documentation for sh
and examples, and I can't understand why this wouldn't work. What am I missing?
推荐答案
根据文档, sh
使用execve语义:
According to the documentation, sh
uses execve semantics:
(sh "dot" "-Tpng" "/.tree.dot" "-o" "/.tree.png")
这篇关于clojure.java.sh:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!