           (let [input-result (.readLine *in*)]
             (nrepl/message client
               {:op "stdin" :stdin (str input-result "\n")
-               :id (nrepl.misc/uuid) :session @current-session})))
+               :id (nrepl.misc/uuid) :session session})))
         (when value ((:value options print) value))
         (when out ((:out options print) out))
         (when err ((:err options print) err))

  [options]
  (let [connection (get-connection options)
        client (nrepl/client connection 10000)
        session (nrepl/new-session client)]
    (reset! current-session session)
    (let [options (assoc options :prompt
                    (fn [ns]
                      (reader.jline/prepare-for-read
                        (partial adhoc-eval client)
                        ns)))
          options (if (:color options)
                    (merge options nrepl.cmdline/colored-output)


(defn execute-with-client [client options form]
  (let [command-id (nrepl.misc/uuid)
        session (or (:session options) @current-session)
        response-seq (nrepl/message client {:op "eval" :code form :id command-id :session session})]
    (reset! current-command-id command-id)
    (doall (for [{:keys [ns value out err] :as res}
                   (take-while #(not (some #{"done" "interrupted" "error"} (:status %)))
