 
 (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)))

  ([] (status nil))
  ([_]
   (let [connection-count (get-in *autobuild-env* [:figwheel-server :connection-count])]
     (println "Figwheel System Status")
     (println "----------------------------------------------------")
     (println "Autobuilder running? :" (builder-running? (:state-atom *autobuild-env*)))
     (display-focus-ids (:focus-ids @(:state-atom *autobuild-env*)))
     (println "Client Connections")
     (when connection-count
       (doseq [[id v] @connection-count]
         (println "\t" (str (if (nil? id) "any-build" id) ":")
                  v (str "connection" (if (= 1 v) "" "s")))))
     (println "----------------------------------------------------"))))

;; end API methods


  (-print-stacktrace [repl-env stacktrace error build-options]
    (doseq [{:keys [function file url line column]}
              (cljs.repl/mapped-stacktrace stacktrace build-options)]
      (repl-println "\t" (str function " (" (str (or url file)) ":" line ":" column ")")))))

(defn repl-env
  ([figwheel-server {:keys [id build-options] :as build}]
