Fork me on GitHub
#babashka
<
2021-05-09
>
Ben Sless06:05:29

Am I doing something wrong here or is there a bug?

bb repl
Babashka v0.4.0 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (require '[babashka.process :refer [process sh]])
nil
user=> (sh ["youtube-dl" "--dump-json" "--ignore-errors" "--skip-download" ""])
Segmentation fault (core dumped)
Even more minimal exaxmple:
bb repl
Babashka v0.4.0 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (require '[babashka.process :refer [process sh]])
nil
user=> (sh ["youtube-dl"])
Segmentation fault (core dumped)

borkdude07:05:45

@ben.sless are you using the static Linux binary perhaps?

borkdude07:05:47

If that’s the case, try the normal one

dorab21:05:08

What is the recommended way to have a bb task that consists of a Unix pipeline? I tried {:tasks {clean (-> (shell "find . -type f -name '*~' -print") (shell "xargs rm -f"))}} but bb clean gives me a java.util.concurrent.ExecutionException.

borkdude21:05:46

@dorab shell doesn't support this with ->, but babashka.process/process does.

borkdude21:05:16

I think shell could support this though (made an issue: https://github.com/babashka/babashka/issues/829)

borkdude21:05:02

What is also possible:

(let [out (:out (shell {:out :string} "find . -type f -name '*~' -print"))]
  (shell {:in out} "xargs rm -f"))

borkdude21:05:43

although I think this can all be done using babashka.fs glob and delete as well

borkdude21:05:16

does *~ mean you want to find all files ending with a tilde, or does it expand into something else?

borkdude21:05:19

{:requires ([babashka.fs :as fs])
 :task (run! fs/delete
             (fs/glob "." "*~"))}