Block repl on prep-tasks.

This commit is contained in:
Phil Hagelberg 2012-03-29 16:36:47 -07:00
parent 6e225eb0a9
commit eef8fe3d08
2 changed files with 16 additions and 14 deletions

View file

@ -59,7 +59,9 @@
;; This must exist before the project is launched.
(.mkdirs (io/file (:compile-path project "/tmp")))
(doseq [task (:prep-tasks project)]
(main/apply-task task (dissoc project :prep-tasks) [])))
(main/apply-task task (dissoc project :prep-tasks) []))
(when-let [prepped (:prepped (meta project))]
(deliver prepped true)))
;; # Subprocess stuff

View file

@ -65,19 +65,19 @@ Connects to the nREPL server running at the given host (defaults to localhost)
and port."
([] (repl nil))
([project]
(nrepl.ack/reset-ack-port!)
(.start
(Thread.
(bound-fn []
(start-server project
(repl-port project)
(-> @lein-repl-server deref :ss .getLocalPort)))))
(if-let [repl-port (nrepl.ack/wait-for-ack (:repl-timeout project 30000))]
(reply/launch-nrepl
(merge
{:attach (str repl-port)}
(:reply-options project)))
(println "REPL server launch timed out.")))
(nrepl.ack/reset-ack-port!)
(let [prepped (promise)]
(.start
(Thread.
(bound-fn []
(start-server (vary-meta project assoc :prepped prepped)
(repl-port project)
(-> @lein-repl-server deref :ss .getLocalPort)))))
@prepped
(if-let [repl-port (nrepl.ack/wait-for-ack (:repl-timeout project 3000))]
(reply/launch-nrepl (merge {:attach (str repl-port)}
(:reply-options project)))
(println "REPL server launch timed out."))))
([project flag & opts]
(case flag
":headless" (do (start-server project