This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-18
Channels
- # adventofcode (69)
- # babashka (21)
- # beginners (246)
- # calva (49)
- # chlorine-clover (19)
- # circleci (3)
- # clj-kondo (38)
- # cljsrn (1)
- # clojure (52)
- # clojure-australia (2)
- # clojure-europe (41)
- # clojure-nl (5)
- # clojure-spec (4)
- # clojure-taiwan (2)
- # clojure-uk (28)
- # clojurescript (12)
- # cryogen (6)
- # cursive (6)
- # datahike (3)
- # deps-new (5)
- # fulcro (2)
- # garden (1)
- # graalvm (3)
- # hoplon (48)
- # jackdaw (6)
- # jobs (3)
- # kaocha (6)
- # malli (3)
- # off-topic (51)
- # rdf (1)
- # reagent (40)
- # reitit (32)
- # remote-jobs (1)
- # reveal (24)
- # shadow-cljs (21)
- # startup-in-a-month (5)
- # xtdb (8)
I played with your remote-repl
a bit, figuring I might be able to use it as an :accept
for a Socket REPL -- which works from the command-line but does not provide a traditional REPL interaction, insofar as it provides no prompt and doesn't print results, so Clover etc can't use it.
Just to confirm the setup I tested on: process A starts prepl on 4112; process B is Reveal's remote-prepl connected to 4112 and exposing 4113; process C was your remote-repl directly, connected to 4113:
;; process A log:
[INFO ] Starting Socket REPL server on port 4111...
[INFO ] ...Socket REPL server ready on port 4111
[INFO ] Starting Socket pREPL server on port 4112...
[INFO ] ...Socket pREPL server ready on port 4112
;; process B startup and log:
(! 555)-> clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version "1.2.188"}}}' -X clojure.core.server/start-server :name '"reveal"' :accept vlaaad.reveal/remote-prepl :args '[:port 4112 ]' :port 4113 :server-daemon false
{:tag :ret, :val [1 2 3], :ns "user", :ms 1, :form "[1 2 3]"}
{:tag :ret, :val [4 5 6], :ns "user", :ms 0, :form "[4 5 6]"}
;; process C startup and log:
(! 635)-> clj -Sdeps '{:deps {vlaaad/remote-repl {:mvn/version "1.1"}}}' -X vlaaad.remote-repl/repl :port 4113
[1 2 3]
[4 5 6]
When process C connects to process B, the Reveal UI pops up. When I typed [1 2 3]
, it appeared in the Reveal UI and it was logged in process B but not printed back into process C. Same with [4 5 6]
.If I type (System/getProperty "user.dir")
into process C, I get the directory of process A, displayed in process B's UI and echoed to process B's console (as expected), but nothing comes back to process C.
@seancorfield this is a bug 🙂 I just released 1.2.189
with a fix
Nice! Ok, I'll update and re-test...
Yup, that works.
Is there a way, from the command-line, to tell Reveal's remote-prepl to print just the :val
instead of the whole prepl result? You mentioned :out-fn
above but I don't know how specify such a body via EDN...
you'll need something like (defn print-val [prepl-result] (println (:val prepl-result)))
somewhere on the classpath and then use :out-fn my.ns/print-val
clojure.core.server/start-server
does not evaluate code for args, only reads forms as edn, not sure there is a way to just supply the form
OK, that's what I thought... Trying that now...
That doesn't seem to echo back to the client C -- just prints on B.
Neither println
nor prn
seem to work.
Oh, it's losing the binding of the output stream?
Yeah, that echoes stuff as expected to the client now. Thanks.
This was an experiment to see whether just returning the value like a regular REPL would be enough to persuade a client that it was dealing with a Socket REPL 🙂 But it isn't quite enough. I'll keep tinkering -- this at least works for my test bed. Thanks!
It was my original motivation. I suspect that it isn't enough to convince unrepl to side-load across the linked processes but I'll dig into it all at a later date at this point.
I'm happy that some of the behavior I was observing was due to Reveal bugs which are now fixed! 🙂