   (let [task-ns (symbol (str "leiningen." task))
         task (symbol task)
         error-fn (fn [& _]
-                   (exit-with-error
-                     (format "%s is not a task. Use \"help\" to list all tasks."
+                   (abort
+                    (format "%s is not a task. Use \"help\" to list all tasks."
                              task)))]
     (try
      (require task-ns)

;; So it doesn't need to be fully-qualified in project.clj
(with-ns 'clojure.core (use ['leiningen.core :only ['defproject]]))

(defn exit-with-error [msg]
  (println msg)
  (System/exit 1))


      (try
       (apply (resolve-task task) args)
       (catch IllegalArgumentException _
         (abort (format "Wrong number of arguments to task %s."
                        task)))))
    ;; In case tests or some other task started any:
    (shutdown-agents)))
