Fork me on GitHub

@nicolas.estrada938 Decided to add support to bb for this trailing map and StackTraceElement. I'm building a new bb version now

โค๏ธ 1

I also tested omniconf and it worked after those fixes

Nicolas Estrada09:06:21

You my friend are a saint! ๐Ÿ™‚


Fun side effect of including StackTraceElement in bb is that you can inspect some of bb/sci's runtime ;)

$ bb -e '(->> (try (/ 1 0) (catch Exception e (.getStackTrace e))) (map bean) clojure.pprint/print-table)'

| :classLoaderName |        :fileName | :moduleVersion | :nativeMethod |                              :className | :moduleName |                            :class | :lineNumber |  :methodName |
|                  | |                |         false |                    clojure.lang.Numbers |             | class java.lang.StackTraceElement |         188 |       divide |
|                  |         core.clj |                |         false |                    clojure.core$_SLASH_ |             | class java.lang.StackTraceElement |        1029 | invokeStatic |
|                  |         core.clj |                |         false |                    clojure.core$_SLASH_ |             | class java.lang.StackTraceElement |        1022 |       invoke |

๐Ÿ™Œ 1

This is pretty cool too. Get info about another process:

$ bb -e '(.info (.get (java.lang.ProcessHandle/of 39045)))'
#object[java.lang.ProcessHandleImpl$Info 0x6bd723ed "[user: Optional[borkdude], cmd: /Applications/, startTime: Optional[2021-05-28T08:59:27.973Z]]"]


so with this you can get command line arguments, the exact binary location of what the process was started with, arguments, etc

Nom Nom Mousse12:06:09

There is supposed to be an alternative to in babashka. What is it called?

Nom Nom Mousse12:06:25

And can I do (bb/sh "ecco my command is just a string") with it? ( "echo hi") fails with

Execution error (IOException) at java.lang.ProcessImpl/forkAndExec (
error=2, No such file or directory

Nom Nom Mousse12:06:20

I do not want to split my command string into whitespace as that might not be easy "ecco 'hi there'":

( (clojure.string/split "echo 'hi there'" #" "))
Execution error (IllegalArgumentException) at (shell.clj:47).
No value supplied for key: ["echo" "'hi" "there'"]

Nom Nom Mousse12:06:01

With apply it works. But I wonder whether this might ever break a command line string.


@endrebak The alternative in babashka is babashka.process/process


The same library has a function called tokenize to split shell functions for you


If you want to invoke a shell command just like how you could do it in the shell, streaming output directly to stdout/stderr, then you could also use (babashka.tasks/shell "echo 'hi there'")


user=> (do @(babashka.tasks/shell "echo 'hi there'") nil)
hi there

Nom Nom Mousse13:06:53

Syntax error (ClassNotFoundException) compiling at (*cider-repl code/myapp:localhost:56301(clj)*:32:12).
My lein coords are:
[babashka/babashka "0.4.4"]

Nom Nom Mousse13:06:22

Also tried:

(require '[babashka.impl.tasks :as tasks])

Syntax error (IllegalArgumentException) compiling . at (borkdude/deps.clj:196:12).
More than one matching method found: newFileSystem


Hmm, babashka isn't really supposed to be used as a JVM project. I was assuming you were using babashka as a tool


But the libraries contained in there, such as babashka.process, are available on the JVM

Nom Nom Mousse13:06:15

Cool! It seems like does not support many simple commands like:

( "sleep" "1" ";" "echo" "2")
;; => {:exit 1, :out "", :err "usage: sleep seconds\n"}
So I'll be looking into babashka :thumbsup:


The problem there is that ";" is bash syntax


if you want to invoke bash, you could invoke bash


with e.g. bash -c "echo hello"

Nom Nom Mousse13:06:40

Thanks ๐Ÿ™‚


2000+ stars! :star-struck:

โค๏ธ 6
๐Ÿ™ 4
๐ŸŒŸ 5
๐Ÿ‘ 1
Karol Wรณjcik12:06:37

Well deserved! Congrats!


So this now works @ben.sless

 {:init (do (def ^:dynamic *java*)
            (def ^:dynamic *browser*))
  test-front-end (println :browser *browser*)
  test-back-end (println :java *java*)
  test-app {:depends [test-front-end test-back-end]}
  run-matrix (doseq [java [8 11]
                     browser ["Safari" "Chrome" "Firefox"]]
               (binding [*java* java
                         *browser* browser]
                 (run 'test-app)))}}
The previous issues are fixed.

๐Ÿ’ช 2
๐Ÿ‘ 1
Ben Sless16:06:32

First, that's pretty cool, ngl, going to try it out Second, have you had a chance to give some thought to my suggestion regarding adding a :matrix key to tasks? I'm willing to donate a hammock ๐Ÿ™‚


Haven't thought through the matrix yet ;)