Fork me on GitHub
#babashka
<
2022-07-14
>
pinkfrog02:07:12

When using bb pods, I noticed a lot of files are created and not removed. The specific pod is epiccastle/spire.

borkdude11:07:02

Not sure why that doesn't happen though. Maybe you're not exiting bb?

pinkfrog11:07:59

I quite with ctrl-c, maybe that is the cause?

borkdude12:07:23

should work I think, but imo this is a bug in spire. can you check if the spire process also died?

pinkfrog15:07:39

There must be some bugs. When I run bb tasks, the port file also get created.

borkdude15:07:19

The port file gets created whenever you load the pod

pinkfrog14:07:00

Seems clojure.core/Inst is not available in bb? I have a file containing this

(extend-protocol clojure.core/Inst
  Duration
  (inst-ms* [v] (.toMillis ^Duration v))
  OffsetDateTime
  (inst-ms* [v] (.toEpochMilli (.toInstant ^OffsetDateTime v))))
and when being required, bb errs with
; Evaluation of file foo.clj failed: class 

borkdude14:07:01

Can you make a full repro including the ns form + imports?

pinkfrog14:07:17

I use calva, and run the bb repl, when I load the file b, error occur

borkdude14:07:33

right. I think extending this protocol isn't supported at the moment. please file an issue if this is important to you

pinkfrog14:07:27

Wonder how protocol works and we need extra work on it.

borkdude14:07:23

The Inst protocol isn't available in bb right now:

clojure.core/Inst

borkdude14:07:52

but adding it isn't as simple as just adding it somewhere. it can be supported though, but takes some effort

Sidestep14:07:17

hi lazy web I think I saw a tweet somewhere

Sidestep14:07:37

that babashka can inovke bash commands directly somehow?

Sidestep14:07:07

full amalgamation of bash and scittle?

Sidestep14:07:14

is this done?

borkdude14:07:47

Welcome @sidestep! Please use a 🧵 for multiple questions about the same subject.

borkdude14:07:19

Babashka has the process library for this. https://github.com/babashka/process

👍 1
pinkfrog15:07:42

Is it possible to provide a different mechanism for bb to list all tasks. Currently it seems bb will load all the required cljs files. which makes the a non-neglibile time for shell completion.

1
borkdude15:07:38

It depends on how you organize your bb.edn

borkdude15:07:16

The completion should normally not execute any code I think

borkdude15:07:14

If you can reproduce the problem with a public repo, I'll take a look

pinkfrog23:07:20

It indeed will not execute any functions, but it will load the related clj namespaces, which also takes time.

lispyclouds07:07:55

@UGC0NEP4Y i have code like:

src
└── foo
    └── bar.clj
bar.clj:
(ns foo.bar)

(println "Printing from ns: Foo")
and bb.edn:
{:paths ["src"]
 :tasks {:requires ([foo.bar :as bar])
         foo       (println 42)}}
You can see Printing from ns: Foo only when doing bb foo or bb run foo not bb tasks which the shell completion uses. Is this what you were trying?

lispyclouds07:07:14

for me the completion time is pretty much the same as bb's startup time, so its expected i guess.

borkdude08:07:03

@U7ERLH6JX can you also try some code in :init?

lispyclouds08:07:53

{:paths ["src"]
 :tasks {:init     (println "Called from Init")
         :requires ([foo.bar :as bar])
         foo       (println 42)}}
result
$ bb foo
Printing from ns: Foo
Called from Init
42
$ bb tasks
The following tasks are available:

foo

borkdude08:07:12

Seems all good then

lispyclouds08:07:24

yeah i think so too

pinkfrog08:07:28

That’s good to hear!