                                (:all-builds *autobuild-env*))]
     (display-focus-ids (map :id builds))
     (mapv cbuild/clean-build (map :build-options builds))
-    (println "Deleting ClojureScript compilation target files.")))
+    (repl-println "Deleting ClojureScript compilation target files.")))
 
 (defn run-autobuilder-helper [build-ids]
   (let [{:keys [all-builds figwheel-server state-atom logfile-path output-writer error-writer]} *autobuild-env*]
     (if-let [errors (not-empty (autobuild/check-autobuild-config all-builds build-ids figwheel-server))]
       (do
         (display-focus-ids build-ids)
-        (mapv println errors))
+        (mapv repl-println errors))
       (when-not (builder-running? state-atom)
         (build-once build-ids)
         

        (recur)))))

(defn add-repl-print-callback! [{:keys [browser-callbacks]}]
  (swap! browser-callbacks assoc "figwheel-repl-print"
         (fn [args] (apply println args))))

(defrecord FigwheelEnv [figwheel-server]
  cljs.repl/IJavaScriptEnv


(def ^:dynamic *autobuild-env* false)

;; slow but works
;; TODO simplify in the future
(defn resolve-repl-println []
  (let [opts (resolve 'cljs.repl/*repl-opts*)]
    (or (and opts (:print @opts))
        println)))

(defn repl-println [& args]
  (apply (resolve-repl-println) args))

(defn at-start-line->canonical-stack-line [line]
  (let [[_ function file-part] (re-matches #"\s*at\s*(\S*)\s*\((.*)\)" line)]
    (str function "@" file-part)))
