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.
Hmm. I would expect no prompts in prepls, but how is it not printing results?
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
maybe it has to be prn
, not sure about that..
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.
ah jeez, I committed my fix without spending enough time in a hammock..
I probably should wrap with bound-fn*
not only the default out-fn, but provided too
Oh, it's losing the binding of the output stream?
yeah... try 1.2.190
🙂
feels strange to demote prepl to repl 😄
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's to make clover to play with reveal more directly, right?
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! 🙂