(planck.shell/with-sh-dir "." (:out (planck.shell/sh "pwd")))
works but (planck.shell/with-sh-dir "." (:out (planck.shell/sh "git log")))
gives me "launch path not accessible"
What's wrong?
Oh, I think I'm not supposed to use spaces
Hmm, not really about planck, but I figure there's people in this channel who could know the answer
I'm wondering why (sh/sh "ag" "a")
doesn't work. The command runs, but exits with 1 and doesn't find anything. (sh/sh "pwd")
tells me I'm in the right directory, and the ag command works fine from the command line
I got it, ag required a path as its third argument
Cool… glad you figured it out @kauko . The planck.shell
namespace is meant to mimic clojure.java.shell
, so you can both use examples in the wild about using the Clojure namespace, and potential bugs in Planck (if it isn’t of high fidelity in corner cases).
Yeah
Though now I ran into the problem of piping ag
's output to wc
Can't figure out how pipes are supposed to work with clojure.java.shell
`
Arg. This exact question came up before and was solved… need to find the web archive of this channel 🙂
I think it involved launching a subshell and having it do the pipe operation.
Like (shell/sh “sh” “-c” “some command string with pipes”)
We need Planck to support https://github.com/mfikes/planck/issues/54
Yeah that worked, thanks 🙂
Is that because of java's shell integration?
It's a shame it works so poorly, I'd love to replace some more complicated bash scripts with clojure
Well, planck is clojurescript I guess
@kauko Well, I believe the concept of pipes are implemented by shells (as in Bash). So, neither Planck nor clojure.java.shell
can directly do anything about pipes. All they can do is launch processes. But… clojure.java.shell
has a facility where you can obtain a stream for stdout and stderr (instead of strings), and with such streams you could theoretically compose them in Clojure to produce pipes. Planck doesn’t yet support the notion of returning a stream, but it probably could fairly easily.