Skip to content

Commit 5a52244

Browse files
Olicalmfikes
authored andcommitted
CLJS-2994 Ensure all prepl :vals are pr-str-ed
The only time this should ever fire is if an exception is caught during evaluation. All other ClojureScript evaluation results are already strings, so we should only ever have to run results of Throwable->map through pr-str. Performing this in the valf allows this to be tweaked by users where required. It also acts as a catch all to ensure _any_ future values that happen to flow through to :val as maps etc instead of strings will get converted. :val should _always_ be a string. This ensures that assumption will always hold true.
1 parent 632a171 commit 5a52244

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/clojure/cljs/core/server.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"prepl bound to *in* and *out*, suitable for use with e.g. server/repl (socket-repl).
134134
:ret and :tap vals will be processed by valf, a fn of one argument
135135
or a symbol naming same (default identity)"
136-
[& {:keys [valf repl-env opts] :or {valf identity}}]
136+
[& {:keys [valf repl-env opts] :or {valf #(if (string? %) % (pr-str %))}}]
137137
(let [valf (resolve-fn valf)
138138
out *out*
139139
lock (Object.)]

0 commit comments

Comments
 (0)