nrepl / nrepl/nrepl

Starting sub-repls from a nrepl client doesn't work (works from lein)

Open
#444 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
906
Forks
108
Avg merge
18h 29m
Merged PRs (30d)
20

Description

Something funky is going on when trying to start a sub(nested) repl from an nrepl client created with nrepl.cmdline itself.

If we start a JVM process exposing a nrepl server on 7777 like this :

$ clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.7.0"}}}' -M -m nrepl.cmdline -p 7777

Then we can connect to it from another terminal, and start a sub-repl :

$ clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.7.0"}}}' -M -m nrepl.cmdline --connect --host localhost --port 7777
nREPL 1.7.0
Clojure 1.12.4
OpenJDK 64-Bit Server VM 24+36-3646
Interrupt: Control+C
Exit:      Control+D or (exit) or (quit)
user=> (clojure.main/repl :prompt #(print "<my-prompt>"))
<my-prompt>(+ 1 2)

The sub-repl starts fine but it doesn't read any characters. Just gets stuck there.

If instead we connect to our nrepl server via the lein client, then it works :

$ lein repl :connect localhost:7777
Connecting to nREPL at localhost:7777
REPL-y 0.5.1, nREPL 1.7.0
Clojure 1.12.4
OpenJDK 64-Bit Server VM 24+36-3646
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (clojure.main/repl :prompt #(print "<my-prompt>"))
<my-prompt>(+ 1 2)
3
<my-prompt>

I have tried different JVM, Clojure and nrepl versions. Also tried on Linux and Windows with the same behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the nested REPL through nrepl.cmdline with the documented server and --connect commands, then compare its behavior with lein repl :connect. Trace the nrepl.cmdline client entry point and the sub-repl startup path; done means the nested REPL accepts input and evaluates (+ 1 2) as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.