Exit after tasks finish when not in interactive task.

This commit is contained in:
Phil Hagelberg 2010-11-24 13:11:44 -08:00
parent 619262621a
commit 94790ce255
2 changed files with 7 additions and 1 deletions

View file

@ -19,6 +19,8 @@
(def *skip-auto-compile* false)
(def *exit-when-done* true)
(defn- regex?
"Returns true if we have regex class"
[str-or-re]
@ -141,7 +143,9 @@
(def ~'*classpath* ~cp)
(set! ~'*warn-on-reflection*
~(:warn-on-reflection project))
~form)]
~form
(when ~*exit-when-done*
(System/exit 0)))]
;; work around java's command line handling on windows
;; http://bit.ly/9c6biv This isn't perfect, but works for what's
;; currently being passed; see

View file

@ -2,6 +2,7 @@
"Enter interactive shell for calling tasks without relaunching JVM."
(:require [clojure.string :as string])
(:use [leiningen.core :only [apply-task exit]]
[leiningen.compile :only [*exit-when-done*]]
[leiningen.repl :only [repl-server repl-socket-on
copy-out-loop poll-repl-connection]]
[leiningen.compile :only [eval-in-project]]))
@ -60,6 +61,7 @@
(symbol ""))))
(let [connect #(poll-repl-connection port 0 vector)]
(binding [eval-in-project (partial eval-in-repl connect)
*exit-when-done* false
exit (fn [_] (println "\n"))]
(task-repl project)))
(exit)))