Fork me on GitHub
#lumo
<
2017-02-06
>
Jon06:02:33

If I start a REPL with lumo -r, can I run another script that sends code the REPL to eval?

Jon06:02:10

By "send code" I mean code like (require x.y :reload)

pesterhazy07:02:34

you mean after the REPL has started?

pesterhazy07:02:43

you can use a socket repl

pesterhazy07:02:16

lumo --socket-repl 9999 -r
# other terminal
echo '(prn "hi")' | nc localhost 9999

Jon07:02:53

In this demo, hi is printed in the second terminal. Can't the code sent from nc affect the original REPL?

pesterhazy07:02:26

try echo '(js/process.exit)' | nc localhost 9999

Jon07:02:17

...and using (def a 1) it's actually working, that's nice

Jon08:02:30

then how about the protocol itself? It appears ns is just sending the code like (str mycode \newline), rather than any protocol

Jon08:02:54

so they are two different things?

pesterhazy08:02:52

yeah it's just a tcp connection ("socket server")

pesterhazy08:02:13

doesn't implement the (more complicated) nREPL protocol

Jon08:02:04

how about telnet? I saw someone using talnet to connect the server

Jon08:02:21

Is telnet just working like nc?

Jon08:02:12

Thanks. not confused with these 3 things now 🙂

pesterhazy08:02:28

telnet is basically an antiquated program, nc does the same thing but is simpler and more robust

Jon08:02:02

I prefer (js/require "net")