Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: 0.2.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
Description
There's a stray "#" in clojure.tools.nrepl.middleware.session/session-out which is turning the body of the (not off) case into a lambda that's never executed:
(cond
(number? x) (.append buf (char x))
(not off) #(.append buf x) ; <----
(instance? CharSequence x) (.append buf ^CharSequence x off len)
:else (.append buf ^chars x off len))
This is causing the newline character in (.println out) and (.println err) to be lost:
user=> (with-open [conn (repl/connect :port 7888)]
(-> (repl/client conn 1000)
(repl/message {:op :eval :code "(do (.println out \"1\") (.println out \"2\") (.println out \"3\")(flush))"})
doall
pprint))
({:out "123", ;; <--- where are my "\n"s?
...}, ...)
Removing the stray "#" fixes the problem:
{:out "1\n2\n3\n",
...}
Reported downstream by jaceklaskowski in https://github.com/technomancy/leiningen/issues/631
Patch with the trivial fix and unit test here: https://wok.meshy.org/~ato/0001-Remove-stray-hash-in-session-out-that-breaks-println-out.patch
Couldn't attach the patch to this issue as JIRA told me I don't have permission. I (Alex Osborne) have signed the Clojure CA and contribute this patch as per the terms of it.
Thank you very much — patch applied to master. I'll cut a new beta release on Monday so downstreams can pick it up.
Good eye, by the way, I'm sure I could have looked for days for that.