Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Custom socket repl accept function seems being ignored #431

Closed
onetom opened this issue Oct 17, 2018 · 0 comments
Closed

Custom socket repl accept function seems being ignored #431

onetom opened this issue Oct 17, 2018 · 0 comments

Comments

@onetom
Copy link
Contributor

onetom commented Oct 17, 2018

When I start lumo with a bogus socket repl accept function

$ lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
Lumo socket REPL listening at localhost:5559.
cljs.user=>

connecting to it won't throw an exception

$ nc localhost 5559
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.10.1
...
cljs.user=> 123
123
cljs.user=>

like it did in earlier versions

lumo -n '{"port":5559, "accept":"XXX"}'
Lumo 1.8.0
ClojureScript 1.9.946
Node.js v9.2.0
...
Lumo socket REPL listening at localhost:5559.
cljs.user=> 

when upon running nc localhost 5559 it throws this error:

cljs.user=> <embedded>:463
cljs.core.symbol.cljs$core$IFn$_invoke$arity$1=function(a){if(a instanceof cljs.core.Symbol)return a;var b=a.indexOf("/");return 1>b?cljs.core.symbol.cljs$core$IFn$_invoke$arity$2(null,a):cljs.core.symbol.cljs$core$IFn$_invoke$arity$2(a.substring(0,b),a.substring(b+1,a.length))};
                                                                                                             ^

TypeError: Cannot read property 'indexOf' of null
    at Function.cljs.core.symbol.cljs$core$IFn$_invoke$arity$1 (<embedded>:463:110)
    at Object.lumo.repl.ns_symbol (<embedded>:6680:514)
    at Object.lumo.repl.run_accept_fn (<embedded>:6682:57)
    at Lt ([eval]:1:31935)
    at Qe ([eval]:1:24855)
    at Server.dn.createServer ([eval]:1:25116)
    at Server.emit (events.js:159:13)
    at TCP.onconnection (net.js:1583:8)

Running it with correct parameters

$ lumo -c src -n '{"port":5559, "accept":"myapp.repl/accept"}'

works on Lumo 1.8.0, but not on 1.9.0-alpha:

$ nc localhost 5559

Hello friend.
You gave me the following args: ({"foo" 2})

when src/myapp/repl.js is:

(ns myapp.repl)

(defn accept [socket & args]
  (.end socket (str "\nHello friend.\nYou gave me the following args: " args "\n\n")))
@onetom onetom changed the title Custom socket repl accept function seems ignored Custom socket repl accept function seems being ignored Oct 17, 2018
onetom added a commit to onetom/lumo that referenced this issue Oct 17, 2018
anmonteiro pushed a commit to onetom/lumo that referenced this issue Oct 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant