This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-26
Channels
- # announcements (17)
- # babashka (68)
- # beginners (8)
- # biff (14)
- # calva (25)
- # cherry (10)
- # clj-kondo (1)
- # clj-on-windows (12)
- # cljsrn (6)
- # clojure (134)
- # clojure-berlin (1)
- # clojure-europe (33)
- # clojure-nl (4)
- # clojure-norway (6)
- # clojure-uk (10)
- # clojurescript (9)
- # datalevin (8)
- # datomic (34)
- # docker (1)
- # emacs (31)
- # fulcro (6)
- # honeysql (8)
- # java (7)
- # joyride (14)
- # kaocha (7)
- # malli (11)
- # nbb (4)
- # off-topic (11)
- # pedestal (14)
- # rdf (53)
- # re-frame (6)
- # reagent (39)
- # reitit (2)
- # releases (9)
- # rewrite-clj (14)
- # shadow-cljs (97)
- # specter (1)
- # testing (5)
- # tools-deps (12)
- # vim (4)
- # xtdb (9)
So I have this code here where I want to follow a log for 30s and then stop a process, what am I doing wrong? it seems to run without stopping.
(let [tail-proc (babashka.process/shell "journalctl -f -u service-name")]
(Thread/sleep 30000)
(babashka.process/destroy-tree tail-proc))
this seems to work in the repl hmm
babashka v0.10.163
weird it does work fine in the repl, but I’m using this in a CI pipeline and there it doesn’t seem to notice 30s have passed
note my repl is actually connected to the same server as the CI agent
trying rn
no, no difference
(future (babashka.process/shell (str "journalctl -f -u service.nae"))
(Thread/sleep 30000)
(System/exit 0
this works
luckily it is the last task in the pipeline 😄
you wanted to check if journalctl is a child process or something?
trying that right now
yeah it doesn’t work
I guess (System/exit 0) it is 🙂
Probably done something stupid I can't see 😅, but I get a Could not find namespace: top.build.build
for the following example https://github.com/dmg46664/problems/tree/main/05_bb_local_root
And then change justrun
to a 1-arg function:
(defn justrun [_]
(println "Hello world!"))
Thank re not needing require.
Never got as far as seeing the arity was wrong though 😅
Even though I have a workaround now, much obliged, it should have worked, no?
Ah! that's what I didn't understand.
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Could not find namespace: top.build.build.
Location: <expr>:4:47
----- Context ------------------------------------------------------------------
1:
2: ;; deps
3:
4: (ns user-f39cc2e2-32f4-4dd5-b013-7c98601c1be1 (:require [top.build.build :as build]))
^--- Could not find namespace: top.build.build.
5: (require '[babashka.tasks #_#_:refer [log]])
6: (when-not (resolve 'clojure)
7: ;; we don't use refer so users can override this
8: (intern *ns* 'clojure babashka.tasks/clojure))
9:
----- Stack trace --------------------------------------------------------------
user-f39cc2e2-32f4-4dd5-b013-7c98601c1be1 - <expr>:4:47
I guess the above error could be better though?Is it a bug or a feature? 😆
I notice babashka, has clojure.data.xml but is there a simple way to use clojure.xml and just get a plain map out of xml source? (I am avoiding the 'zippers' stuff :)
clojure.xml
is effectively deprecated in favor of clojure.data.xml
. https://github.com/babashka/babashka/blob/master/examples/xml-example.clj is an xml example <- @roguas
Hi there, I am trying to use org.jsoup/jsoup {:mvn/version "1.15.3"}
in babashka - but I do not seem I can do it
Is that the case? Are java dependencies usable from bb
?
@richiardiandrea Correct, you can't use Java libraries in bb - only classes that are added at compile time are supported. This restriction doesn't apply for #C029PTWD3HR and Node.js libraries.
@richiardiandrea There are various pods that you can use in bb to parse HTML though
ok yeah, I'll have to investigate those - the problem is the code should be compatible for both bb
and clojure
- I'll have a look
well unfortunately there is only one pod that does something similar to what we are doing...and I don't see html pods in the list, I'll dig more
@richiardiandrea There are two: jsoup and bootleg
Oh ok I checked here https://github.com/babashka/babashka/blob/master/doc/projects.md#pods Do you want me to PR your link to the README?
ok let me do that
Hm, it already has that right? > See https://github.com/babashka/pod-registry for an overview of available pods.
oh I did not see that, I went all the way down to the main README here https://github.com/babashka/babashka#pods
yeah, where was your sentence taken from?
It's not babashka/README.md
right?
ok I am confused then, sorry - maybe I just missed it
ok created this one, I hope it makes sense https://github.com/babashka/babashka/pull/1411
@j3k.walczak Hi, I am looking at https://github.com/vollcheck/pod-jaydeesimon-jsoup and I see that you have not enabled issues...I am wondering if you accept PRs against that project? We would like to add some stuff to it 😄
hi @richiardiandrea I've unlocked things that were unlockable although bear in mind that as @U04V15CAJ said it's a fork with purpose to make it available in the pod registry really.
@richiardiandrea bootleg also has jsoup - don't know exactly what you're after though
I am basically in need of using (.getErrors ^Parser parser)
when Jsoup detects syntax errors
This is usually done by sharing the parser, which you can pass down as last argument to Jsoup/parse