Fork me on GitHub
#reveal
<
2021-01-18
>
seancorfield03:01:47

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.

vlaaad06:01:25

Hmm. I would expect no prompts in prepls, but how is it not printing results?

seancorfield18:01:21

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].

seancorfield18:01:22

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.

vlaaad19:01:49

@seancorfield this is a bug 🙂 I just released 1.2.189 with a fix

seancorfield19:01:02

Nice! Ok, I'll update and re-test...

seancorfield19:01:44

Yup, that works.

seancorfield19:01:24

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...

vlaaad19:01:11

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

vlaaad19:01:57

maybe it has to be prn , not sure about that..

vlaaad20:01:11

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

seancorfield20:01:38

OK, that's what I thought... Trying that now...

seancorfield20:01:32

That doesn't seem to echo back to the client C -- just prints on B.

seancorfield20:01:36

Neither println nor prn seem to work.

vlaaad20:01:09

ah jeez, I committed my fix without spending enough time in a hammock..

vlaaad20:01:17

I probably should wrap with bound-fn* not only the default out-fn, but provided too

seancorfield20:01:22

Oh, it's losing the binding of the output stream?

vlaaad20:01:39

yeah... try 1.2.190 🙂

vlaaad20:01:35

feels strange to demote prepl to repl 😄

seancorfield20:01:32

Yeah, that echoes stuff as expected to the client now. Thanks.

seancorfield20:01:14

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!

vlaaad20:01:08

It's to make clover to play with reveal more directly, right?

seancorfield20:01:59

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.

seancorfield21:01:59

I'm happy that some of the behavior I was observing was due to Reveal bugs which are now fixed! 🙂

😀 3