From b237bb4541ea119e5202fb1341a0115ad09fcccc Mon Sep 17 00:00:00 2001 From: davidnolen Date: Tue, 26 May 2026 14:26:21 -0400 Subject: [PATCH] CLJS-3480: Browser REPL - (println "Expected:") breaks REPL - remove the pr-str in clojure.browser/repl-print print etc will set *print-readably* to false, so this can't possibly be right. This appears to be vestigial from the early days of bREPL development - in cljs.repl.browser/handle-post :print, drop edn/read-string the server really doesn't know anything about printing ClojureScript, it should just print the value given. - running tests interactively in bREPL now behaves the same as under the Node.js REPL --- src/main/cljs/clojure/browser/repl.cljs | 2 +- src/main/clojure/cljs/repl/browser.clj | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/cljs/clojure/browser/repl.cljs b/src/main/cljs/clojure/browser/repl.cljs index bd2469933..abfed75a0 100644 --- a/src/main/cljs/clojure/browser/repl.cljs +++ b/src/main/cljs/clojure/browser/repl.cljs @@ -49,7 +49,7 @@ (garray/clear print-queue)) (defn repl-print [data] - (.push print-queue (pr-str data)) + (.push print-queue data) (when @parent-connected? (flush-print-queue! @xpc-connection))) diff --git a/src/main/clojure/cljs/repl/browser.clj b/src/main/clojure/cljs/repl/browser.clj index 34ae35d60..df8837652 100644 --- a/src/main/clojure/cljs/repl/browser.clj +++ b/src/main/clojure/cljs/repl/browser.clj @@ -306,9 +306,13 @@ [{:keys [repl data order] :as _request-content} conn _] (constrain-order order (fn [] - (binding [*out* (or (and repl (.get outs repl)) *out*)] - (print (edn/read-string data)) - (.flush *out*)))) + (try + (binding [*out* (or (and repl (.get outs repl)) *out*)] + (print data)) + (catch Throwable t + (print t)) + (finally + (.flush *out*))))) (server/send-and-close conn 200 "ignore__")) (defmethod handle-post :result