This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-09
Channels
- # announcements (9)
- # babashka (14)
- # beginners (27)
- # biff (4)
- # calva (3)
- # cider (14)
- # clojure (36)
- # clojure-austin (1)
- # clojure-europe (43)
- # clojure-japan (4)
- # clojure-nl (2)
- # clojure-norway (59)
- # clojure-uk (6)
- # clojurescript (13)
- # conjure (2)
- # data-science (3)
- # datomic (3)
- # deps-new (40)
- # hyperfiddle (72)
- # jobs (2)
- # lsp (8)
- # malli (10)
- # missionary (3)
- # off-topic (22)
- # overtone (3)
- # reagent (12)
- # releases (1)
- # squint (1)
I am a beginner with Babashka. I have a series of operations which I repeat each day. I decided to write a Babashka script to automate those operations. One of the operations is to start Emacs editing a file, as a separate process (i.e. with '&' at end when using bash). My question is - how to tell Babashka to start an independent process and eventually finish the script WITHOUT waiting for Emacs to exit? The bash script which I want to run under Babashka is:
echo Starting a True session
xdg-open
emacs --geometry 80x50+1940+16 ~/work/on-the-truth.txt & # I do not know how to formulate it in Babashka-Clojure.
egrep -i big.*lies ~/work/mixed.txt
Hey welcome. You can do this by launching the process asynchronously with:
(babashka.process/process "the-process" "arg1" "arg2")
I expected this to work:
(babashka.process/process {:inherit true} "emacs" "some-file")
It does for most command line programsThis works for me on macOS:
(babashka.process/shell "open" "-a" "emacs" "/tmp")
(println "Hello")
xdg-open
would work in your case, but only if you're able to pass it a preferred application
I use Linux (Debian Bullseye). Turns out that the following worked for me without the need for any special arguments.
(process "emacs" "--geometry" "80x50+1940+16" "/home/omer/work/on-the-truth.txt")
By the way, xdg-open
worked for me without special preparations. It seems to recognize my desktop-configured default browser.
So, my first actual Babashka script works! (and the directory which hosts it has no *.edn files)
Thanks for your help!I have weird issue with babashka fs, when I try to use fs/copy, it throws an error "java.nio.file.FileSystemException" "/pom.xml: Read-only file system". I'm using mac and it has all the rights to write, also manully or through console cp works without a problem for this file. Any ideas?