This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-05
Channels
- # announcements (2)
- # babashka (19)
- # beginners (14)
- # biff (10)
- # calva (23)
- # clojure (49)
- # clojure-europe (15)
- # clojure-nl (3)
- # clojure-norway (25)
- # clojure-seattle (1)
- # clojure-uk (4)
- # clojurescript (7)
- # data-science (6)
- # datahike (3)
- # datomic (1)
- # emacs (13)
- # events (2)
- # fulcro (3)
- # graalvm (13)
- # hyperfiddle (32)
- # leiningen (4)
- # lsp (38)
- # malli (1)
- # missionary (34)
- # nbb (28)
- # off-topic (42)
- # other-languages (5)
- # portal (8)
- # practicalli (1)
- # re-frame (3)
- # releases (1)
- # ring (7)
- # shadow-cljs (13)
- # sql (3)
I've found some interesting backlog chat from this channel online about handling signals in babashka. At the time sun.misc.Signal
was referenced, back in 2022. But I've found other stuff online that talks about this being "the old way to handle signals, pre Java-9".
Is there a better way to do it now, or is that still the best idea?
Yeah, I was also having trouble working out what (if anything) a new version should use...
Hmm. Looks like for my use case (cleanup on SIGTERM before SIGKILL) I can just do
(-> (Runtime/getRuntime)
(.addShutdownHook (Thread. ^Runnable (fn [] (println "Weeeee")))))
And I think the conversation about sun.misc.Signal
being the old way was specifically for handling shutdown signals, rather than anything else
This isn't an important suggestion at all, but borkdude I'm curious if you've ever thought of adding a flag for running a script stored at a url? like bb --url
. It would be equivalent to bb -e '(load-string (slurp "https:/example.com/some-script.bb"))'
, just a bit prettier. Of course there's the question of whether it's actually a good idea to make running scripts off the internet more convenient--maybe a little more verbosity in that case is better anyway 😉
Context: https://clojurians.slack.com/archives/C013Y4VG20J/p1693858311034189, https://biffweb.com/docs/get-started/new-project/
you can also let users install your tool via brew/scoop (see neil for an example of this) or use #C0400TZENE7 (easier for existing bb users)
👍 I think -e '(load-string (slurp ...))'
is probably still the least verbose of these options; I'll likely just go with that. Thanks!