Fork me on GitHub
#planck
<
2017-02-17
>
kauko08:02:33

(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"

kauko08:02:42

What's wrong?

kauko09:02:37

Oh, I think I'm not supposed to use spaces

kauko11:02:31

Hmm, not really about planck, but I figure there's people in this channel who could know the answer

kauko11:02:32

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

kauko12:02:46

I got it, ag required a path as its third argument

mfikes12:02:43

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).

kauko12:02:09

Though now I ran into the problem of piping ag's output to wc

kauko12:02:26

Can't figure out how pipes are supposed to work with clojure.java.shell`

mfikes12:02:38

Arg. This exact question came up before and was solved… need to find the web archive of this channel 🙂

mfikes12:02:06

I think it involved launching a subshell and having it do the pipe operation.

mfikes12:02:35

Like (shell/sh “sh” “-c” “some command string with pipes”)

kauko13:02:56

Yeah that worked, thanks 🙂

kauko13:02:16

Is that because of java's shell integration?

kauko13:02:34

It's a shame it works so poorly, I'd love to replace some more complicated bash scripts with clojure

kauko13:02:17

Well, planck is clojurescript I guess

mfikes13:02:07

@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.