This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-26
Channels
- # announcements (1)
- # babashka (106)
- # beginners (11)
- # biff (7)
- # calva (16)
- # clj-kondo (40)
- # clj-on-windows (5)
- # clj-yaml (10)
- # clojars (4)
- # clojure (37)
- # clojure-austin (22)
- # clojure-australia (1)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-spec (6)
- # clojure-uk (6)
- # clojurescript (13)
- # conjure (11)
- # cursive (14)
- # datalevin (8)
- # datascript (5)
- # emacs (39)
- # events (1)
- # fulcro (55)
- # gratitude (4)
- # holy-lambda (2)
- # humbleui (9)
- # instaparse (1)
- # lsp (3)
- # malli (12)
- # meander (2)
- # membrane (7)
- # nbb (1)
- # off-topic (16)
- # pathom (9)
- # releases (3)
- # sci (14)
- # shadow-cljs (25)
I have a emacs
/WSL question. As far as I understand it, most people using Clojure on WSL launch their REPLs inside the WSL environment, because that's where emacs
is usually running.
I've been trying to launch my Clojure REPL from within Windows via pwsh
and then use cider-connect
to attach to it from emacs
under WSL using the Windows IP and REPL port. Even though I can ping
and curl
the WSL IP (so at least some of my firewall settings are working properly), cider-connect
always times out.
Has anyone successfully connected to a Windows Clojure process from within WSL? What do I need to look out for?
starting nREPL process on Windows side:
clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version ""0.28.5""}}}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" -b 0.0.0.0 -p 51248
in WSL, cat /etc/resolv.conf
and look at the IP for the nameserver, that's the IP you want to use for cider-connect
In my case I can cider-connect
from WSL to 127.21.192.1 port 51248 to connect to the Windows REPL.my guess is however you're starting the repl in Windows is binding to localhost and you need to bind it to 0.0.0.0 instead
you can access WSL localhost services from Windows, but not Windows localhost services from WSL
I was able to get this working by binding to 0.0.0.0
- thanks for the pointer. There's actually an easier way from WSL to get the Windows address (at least in WSL2 which has some DNS convenience stuff) - you can just run $(hostname).local
and use that address for cider-connect
.
However, establishing the connection is extremely slow (upwards of 2 minutes to connect for the first time). Ordinary REPL commands seem to work fine without much latency once the connection is open, but it's still slow enough to be a major hassle when initializing a project. I'm not quite sure how to go about diagnosing that, but at least I know this method works.