我想阅读 shell 命令的输出。我要读取的 shell 命令必须从特定位置运行。(它是git log)。
cd除了进入位置,运行(clojure.java.shell/sh "git log"),然后cd返回工作目录之外,还有什么好方法吗?
我正在寻找某种(shell-at directory command)功能。此功能的简单实现也将不胜感激。我对 Clojure 的经验很少。
clojure.java.shell/sh支持:dir设置子进程工作目录的选项:
(clojure.java.shell/sh "git" "log" :dir "/path/to/some/directory")
见这里。