This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-14
Channels
- # announcements (2)
- # babashka (27)
- # beginners (20)
- # biff (1)
- # cljs-dev (2)
- # clojars (19)
- # clojure (50)
- # clojure-austin (10)
- # clojure-australia (8)
- # clojure-europe (23)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-spec (7)
- # clojured (7)
- # clojurescript (19)
- # cursive (4)
- # datalevin (9)
- # datomic (15)
- # emacs (7)
- # fulcro (25)
- # gratitude (2)
- # helix (1)
- # holy-lambda (2)
- # hyperfiddle (14)
- # introduce-yourself (1)
- # jobs (5)
- # joyride (2)
- # juxt (3)
- # kaocha (9)
- # leiningen (14)
- # meander (9)
- # minecraft (34)
- # nbb (18)
- # off-topic (15)
- # polylith (12)
- # re-frame (4)
- # remote-jobs (1)
- # shadow-cljs (79)
- # vim (57)
Added an example of how to call kaocha with babashka CLI https://github.com/babashka/cli#kaocha And now I also made a #babashka-cli channel - anything about that project will be discussed there
Hey! I'm trying to use babashka/process to execute a command that requires sudo
.
So far, I have this, but I'm not sure how to wait for the root password and avoid terminating immediately...
(defn rebuild [flake]
(do (p/process
["sudo" "nixos-rebuild" "switch"
"--flake" flake
"--option" "pure-eval" "no"]
{:out :inherit})
nil))
Any tips? Is there a better way to acquire root permissions for the command?Use :in :inherit
to let the process read input. Also you might want to block for the process until it ends by derefing it: (do @(p/process ...))
ah thank you! definitely want both of those
that works perfectly - thanks!
@U03KM7AH74L If you are on the newest version you might want to use p/shell
here which blocks and also inherits :in
automatically and has a nicer syntax:
(p/shell "sudo nixos-rebuild switch ...")
Hello! This is probably a lot simpler than I’m thinking, but;
I made a little web-server in Babashka and was wondering how I can run an nrepl-server alongside the webserver?
In other words, how can I start an nrepl-server in Babashka via code? Or can I maybe use bb nrepl-server
and also run a main-method at the same time? :thinking_face:
@odd.andreas you can maybe use the --init
flag which allows you to execute a file prior to the nrepl-server command
Interesting workaround, seems to do the trick! If your script has a main-function I guess you should make another one that just invokes it, or are there other cool tricks for invoking a function too? 😁
sorry, was in a meeting!
So in this hypothetical scenario I’d have a server.clj
script file, with a main-function that launches a web server.
If I want to start both an nrepl-server and the webserver, I guess I would ideally want to do something like
bb --init server.clj -m server[/-main] nrepl-server
In the current working example I don’t have a main-function, so the web-server just starts because of the file being initialized 😊In this scenario you can use this trick: https://book.babashka.org/#main_file
I think it would be better if we made the starting of the nREPL server programmatically available
Alright, thanks! Being able to start a server programmatically would be neat, but in the short term it seems like my use-case is covered using --init
:thumbsup:
I made an issue to the best of my ability 😊 Thanks! https://github.com/babashka/babashka/issues/1295
What is the right way to create a classpath for uberscript? Trying to create a container with bb. When I use babashka/babashka:latest image the following lines give an error.
RUN clojure -Sdeps '{:mvn/local-repo "./.m2/repository"}' -Spath > cp
RUN ./bb -cp $(cat cp) -m lambda.core --uberscript core.clj
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: java.lang.IllegalArgumentException: host is null: http:///2018-06-01/runtime/invocation/next
Location: /var/task/src/lambda/impl/runtime.clj:43:11
@U96LS78UV Just run bb uberscript
and put your deps in bb.edn
An uberjar can also be an option, if uberscript doesn't work:
bb uberjar foo.jar -m lambda.core
bb foo.jar