 (defn run-repl
   [process in out]
   (stop-process process)
-  (->> (start-self-process process nil "clojure.main")
+  (->> (start-process-indirectly process nil "clojure.main")
        (start-thread in out)))
 
 (defn run-logcat

  (System/setProperty "jline.terminal" "dumb")
  (let [path "."
        project-map (-> (read-project-clj path)
                        add-sdk-path
                        leiningen.core.project/init-project)]
    (case cmd
      "build" (build-project-task path project-map)
      "clean" (clean-project-task path project-map)
      "repl" (run-repl-project-task path project-map)
      "run" (run-project-task path project-map)
      "test" (test-project-task path project-map)
      nil))
  (System/exit 0))

                     (.getCanonicalPath jar-file))
                   args)))

(defn start-process-directly
  [process path func]
  (let [project-map (-> (read-project-clj path)
                        (assoc :eval-in :trampoline
                               :jvm-opts [(str "-agentlib:jdwp="
                                               "transport=dt_socket,"
                                               "server=y,"
                                               "suspend=n,"
                                               "address=7896")]))
        forms leiningen.core.eval/trampoline-forms
        profiles leiningen.core.eval/trampoline-profiles]
    (reset! forms [])
    (reset! profiles [])
    (func path project-map)
    (doseq [i (range (count @forms))]
      (->> (leiningen.core.eval/shell-command project-map (nth @forms i))
           (start-process process path)))))

(defn stop-process
  [process]
  (when @process
