   (.start
         (Thread.
           #(try
-            (let [rv (read-messages (:in @(:socket repl-env)) (:response-channel repl-env))]
+            (let [rv (read-messages (:in @(:socket repl-env)) (:response-promise repl-env))]
               (when (= :eof rv)
                 (close-socket @(:socket repl-env))))
             (catch IOException e

  [repl-env js]
  (let [{:keys [out]} @(:socket repl-env)
        response-promise (promise)]
    (reset! (:response-channel repl-env) response-promise)
    (write out js)
    (let [response @response-promise]
      (if (= :eof response)

             (js/CLOSURE_IMPORT_SCRIPT
               (aget (.. js/goog -dependencies_ -nameToPath) name))))))))

(defrecord JscEnv [host port socket response-promise]
  repl/IJavaScriptEnv
  (-setup [this opts]
    (setup this opts))
