                 (Platform/runLater
                   (fn []
                     (.executeScript engine cmd)))
-                (recur (.read in-pipe ca))))))))
-    (.start
-      (Thread.
-        (fn []
-          (binding [*out* out
-                    *err* out
-                    *in* (LineNumberingPushbackReader. in)]
-            (clojure.main/repl)))))))
+                (recur (.read in-pipe ca))))))))))
 
 (fdef init-console!
-  :args (s/cat :webview spec/node? :runtime-state map?))
-(defn init-console! [webview runtime-state]
+  :args (s/cat :webview spec/node? :runtime-state map? :work-fn fn?))
+(defn init-console! [webview runtime-state work-fn]
   (let [engine (.getEngine webview)]
     (.load engine (str "http://localhost:"
                       (:web-port runtime-state)

           [net.sekao.nightcode.editors Bridge]))

(fdef onload
  :args (s/cat :engine :clojure.spec/any))
(defn onload [^WebEngine engine]
  (let [out-pipe (PipedWriter.)
        in (PipedReader. out-pipe)
        pout (PipedWriter.)
        out (PrintWriter. pout)
        in-pipe (PipedReader. pout)
        ca (char-array 256)]
    (.start
      (Thread.
        (fn []

  (let [buttons (-> pane .getChildren (.get 0) .getChildren seq)
        webview (-> pane .getChildren (.get 1))]
    (shortcuts/add-tooltips! buttons)
    (init-console! webview runtime-state clojure.main/repl)))
