cursive
cursive copied to clipboard
Error handling response - class java.lang.IllegalArgumentException for stdout in go blocks
Printing to stdout in go blocks results in an error:
Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil
I'm using a socket REPL.
To reproduce:
;; With require [clojure.core.async :as async :refer [go <!]]
;; Timbre
(def test-ch (async/chan))
(go
(loop [msg (<! test-ch)]
(if msg
(do
(timbre/info msg)
(recur (<! test-ch)))
(timbre/info "Shutting down loop…"))))
(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil
(async/close! test-ch)
;; Println
(def test-ch (async/chan))
(go
(loop [msg (<! test-ch)]
(if msg
(do
(println msg)
(recur (<! test-ch)))
(println "Shutting down loop…"))))
(async/put! test-ch "Hello")
;; Yields Error handling response - class java.lang.IllegalArgumentException: No implementation of method: :out of protocol: #'cursive.repl/Handler found for class: nil
(async/close! test-ch)
;; Tap
(def test-ch (async/chan))
(go
(loop [msg (<! test-ch)]
(if msg
(do
(tap> msg)
(recur (<! test-ch)))
(tap> "Shutting down loop…"))))
(async/put! test-ch "Hello")
;; Works fine.
(async/close! test-ch)
I ran into the same thing and fwiw I was able to solve it by just using nREPL instead of a normal socket REPL. This slack thread kind of explains what's going on in greater detail.