I would like to read the output of a shell command. The shell command I want to read must be run from a specific location. (it's git log
).
Is there a nice way to do this other than cd
ing into the location, running (clojure.java.shell/sh "git log")
, and then cd
ing back to the working directory?
I'm looking for some sort of (shell-at directory command)
function. A simple implementation of this function would also be appreciated. My experience with Clojure is minimal.
clojure.java.shell/sh
supports a :dir
option to set the working directory of the sub-process:
(clojure.java.shell/sh "git" "log" :dir "/path/to/some/directory")
See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With