line-seq and read-line don't return nil on Ctrl-D in lein repl

Description

Executing in lein repl either

(doseq [line (line-seq (java.io.BufferedReader. in)) :while line]
(println line))

Or

(doseq [line (read-line) :while line]
(println line))

One would expect these to return on a user's enter of Ctrl-D, however they never return.

Environment

OSX, lein repl

Activity

Show:
Andy Fingerhut
August 25, 2014, 5:42 PM

Geoff, it looks like there have been recent changes committed to the tools.nrepl library related to this issue. tools.nrepl is used within Leiningen to implements its REPL.

https://github.com/clojure/tools.nrepl/commit/eb526fd8498ced1b4bd1555f8ff680f3ad65f1b4

Alex Miller
August 22, 2014, 2:29 PM

Agreed with Andy - these examples work fine in base repl but other environments may be affecting your input upstream of clojure.

Andy Fingerhut
August 22, 2014, 5:51 AM

If instead of 'lein repl' you run:

at a shell prompt, you get a REPL where the first doseq expression you give does return when you enter Ctrl-D.

The second doseq expression returns a string from (read-line), and then the doseq iterates over that as a sequence of characters, and it returns without needing Ctrl-D after reading a single line in both 'lein repl' and the plain Clojure REPL with the command given above.

I suggest that the behavior with your first doseq expression is an issue to be taken up with the Leiningen developers. Several ways of contacting them are given at http://leiningen.org/#community I would recommend IRC or the email list first, before creating a Github issue.

Not Reproducible
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

import

Labels

Priority

Major

Affects versions