Skip to content

Commit

Permalink
Update some legacy nREPL code
Browse files Browse the repository at this point in the history
* server is no longer something you can deref (it's a regular record)
* passing a nil port is the same as passing 0
  • Loading branch information
bbatsov authored and trptcolin committed Nov 1, 2018
1 parent 92770e3 commit 7fe67e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions spec/reply/integration_spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
(around [f]
(let [cl (classlojure/classlojure
(str "file:" (:local-path logging))
(str "file:" (:local-path bencode))
(str "file:" (:local-path nrepl))
(str "file:" (:local-path clojure)))
server-port
Expand Down
6 changes: 2 additions & 4 deletions src/clj/reply/eval_modes/nrepl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,9 @@

(defn get-connection [{:keys [attach host port]}]
(let [server (when-not attach
(nrepl.server/start-server
:port (Integer/parseInt (str (or port 0)))))
(nrepl.server/start-server :port port))
port (when-not attach
(let [^ServerSocket socket (-> server deref :ss)]
(.getLocalPort socket)))
(:port server))
url (url-for attach host port)]
(when server
(reset! nrepl-server server))
Expand Down

2 comments on commit 7fe67e4

@glts
Copy link
Contributor

@glts glts commented on 7fe67e4 May 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov Unfortunately this change dropped conversion of string to integer, breaking lein trampoline repl, see technomancy/leiningen#2572.

@bbatsov
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look.

Please sign in to comment.