Skip to content

Commit 726ec27

Browse files
author
dnolen
committed
don't use print unless printing the result of eval
1 parent 314efee commit 726ec27

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/clj/cljs/repl.clj

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,10 @@
331331
([stacktrace opts]
332332
(doseq [{:keys [function file line column]}
333333
(mapped-stacktrace stacktrace opts)]
334-
((:print opts) "\t"
335-
(str (when function (str function " "))
336-
"(" file (when line (str ":" line)) (when column (str ":" column)) ")")))))
334+
(err-out
335+
(println "\t"
336+
(str (when function (str function " "))
337+
"(" file (when line (str ":" line)) (when column (str ":" column)) ")"))))))
337338

338339
(comment
339340
(cljsc/build "samples/hello/src"
@@ -382,28 +383,26 @@
382383
(defn- display-error
383384
([repl-env ret form opts]
384385
(display-error repl-env ret form (constantly nil) opts))
385-
([repl-env ret form f {:keys [print flush] :as opts}]
386+
([repl-env ret form f opts]
386387
(err-out
387388
(f)
388389
(when-let [value (:value ret)]
389-
(print value))
390+
(println value))
390391
(when-let [st (:stacktrace ret)]
391392
(if (and (true? (:source-map opts))
392393
(satisfies? IParseStacktrace repl-env))
393394
(let [cst (try
394395
(-parse-stacktrace repl-env st ret opts)
395396
(catch Throwable e
396397
(when (:repl-verbose opts)
397-
(print "Failed to canonicalize stacktrace")
398-
(print (Throwables/getStackTraceAsString e))
399-
(flush))))]
398+
(println "Failed to canonicalize stacktrace")
399+
(println (Throwables/getStackTraceAsString e)))))]
400400
(if (vector? cst)
401401
(if (satisfies? IPrintStacktrace repl-env)
402402
(-print-stacktrace repl-env cst ret opts)
403403
(print-mapped-stacktrace cst opts))
404-
(print st)))
405-
(print st))
406-
(flush)))))
404+
(println st)))
405+
(println st))))))
407406

408407
(defn evaluate-form
409408
"Evaluate a ClojureScript form in the JavaScript environment. Returns a
@@ -454,7 +453,7 @@
454453
(distinct (vals (:uses ast))))
455454
opts))
456455
(when *cljs-verbose*
457-
(err-out ((:print opts) js)))
456+
(err-out (println js)))
458457
(let [ret (-evaluate repl-env filename (:line (meta form)) wrap-js)]
459458
(case (:status ret)
460459
:error (throw
@@ -809,8 +808,7 @@
809808
((ns-resolve 'clojure.core 'binding-conveyor-fn)
810809
(fn []
811810
(let [log-file (io/file (util/output-directory opts) "watch.log")]
812-
(err-out (print "Watch compilation log available at:" (str log-file)))
813-
(flush)
811+
(err-out (println "Watch compilation log available at:" (str log-file)))
814812
(try
815813
(let [log-out (FileWriter. log-file)]
816814
(binding [*err* log-out

src/clj/cljs/repl/browser.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,13 @@ goog.events.getProxy/f<@http://localhost:9000/out/goog/events/events.js:276:16"
486486
ordering (:ordering repl-env)
487487
es (:es repl-env)
488488
server/state (:server-state repl-env)]
489-
(repl/err-out ((:print opts) "Compiling client js ..."))
489+
(repl/err-out (println "Compiling client js ..."))
490490
(swap! browser-state
491491
(fn [old]
492492
(assoc old :client-js
493493
(create-client-js-file
494494
repl-env (io/file working-dir "client.js")))))
495-
(repl/err-out ((:print opts) "Waiting for browser to connect ..."))
495+
(repl/err-out (println "Waiting for browser to connect ..."))
496496
opts
497497
(server/start repl-env)))
498498

0 commit comments

Comments
 (0)