weavejester / lein-ring

Ring plugin for Leiningen
Eclipse Public License 1.0
501 stars 100 forks source link

ensure-handler-set! incorrectly calls System/exit #196

Closed cursive-ide closed 6 years ago

cursive-ide commented 6 years ago

leiningen.ring.util/ensure-handler-set! checks that the :handler configuration is present in the project map, and calls (System/exit 1) if it is not. System/exit should never be called from within the lein process, including in plugin code. leiningen.core.main/exit should be called instead, which allows tools to rebind *exit-process?* to determine whether the process should actually quit or not.

In the case of Cursive, Cursive calls lein in several steps, some of which are performed in-process for performance. This bug means that a simple misconfiguration in the run configuration used to call lein will result in the entire IDE being shut down with no useful message displayed to the user.

MichaelBlume commented 6 years ago

Note, leiningen.core.main/exit has been present in leiningen since version 2.1.0, which was released in March 2013. I'm gonna make an executive decision and assume lein-ring users are using at least 2.1.0.

MichaelBlume commented 6 years ago

Done, fixed in 0.12.2

MichaelBlume commented 6 years ago

Thanks =)

cursive-ide commented 6 years ago

@MichaelBlume Thanks for the quick response!