Skip to content

Commit dbf10e5

Browse files
committed
set *print-err-fn* in Rhino & Nashron REPLs
1 parent b24b354 commit dbf10e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/clojure/cljs/repl/nashorn.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@
121121
'(do
122122
(.require js/goog "cljs.core")
123123
(set! *print-newline* false)
124-
(set! *print-fn* js/print)))
124+
(set! *print-fn* js/print)
125+
(set! *print-err-fn* js/print)))
125126
;; monkey-patch goog.isProvided_ to suppress useless errors
126127
(repl/evaluate-form this env repl-filename
127128
'(set! js/goog.isProvided_ (fn [ns] false)))

src/main/clojure/cljs/repl/rhino.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
(Context/javaToJS opts scope))
125125
(ScriptableObject/putProperty scope
126126
"out" (Context/javaToJS *out* scope))
127+
(ScriptableObject/putProperty scope
128+
"err" (Context/javaToJS *err* scope))
127129

128130
;; define file loading, load goog.base, load repl deps
129131
(rhino-eval repl-env "bootjs" 1 bootjs)
@@ -135,7 +137,8 @@
135137
(repl/evaluate-form repl-env env "<cljs repl>"
136138
'(do
137139
(.require js/goog "cljs.core")
138-
(set! *print-fn* (fn [x] (.write js/out x)))))
140+
(set! *print-fn* (fn [x] (.write js/out x)))
141+
(set! *print-err-fn* (fn [x] (.write js/err x)))))
139142

140143
;; allow namespace reloading
141144
(repl/evaluate-form repl-env env "<cljs repl>"

0 commit comments

Comments
 (0)