cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Shutdown hooks don't run in REPL

Open sfnelson opened this issue 7 years ago • 2 comments

When using the REPL, I would expect Stop REPL or Close REPL Tab to shut down the REPL JVM gracefully, running any shutdown hooks as appropriately.

Example:

(.addShutdownHook (Runtime/getRuntime) (Thread. ^Runnable (fn [] (println "shutdown")) "shutdown"))

When run in a Clojure REPL or Leiningen nREPL, the JVM will print shutdown before it terminates.

When run in Cursive's REPL nothing is printed when Stop REPL is pressed. If you end the process by calling (System/exit 0) the hook does run, so it is being registered successfully.

Maybe relevant: https://stackoverflow.com/a/4727696/1209442

sfnelson avatar Jul 11 '17 04:07 sfnelson

This issue is relevant because it prevents File/deleteOnExit hook from running, which leaks temporary files (e.g. test output).

sfnelson avatar Jul 11 '17 04:07 sfnelson

Having the same issue here (5 years on). Temurin 17 JDK, OS X 12.3, IntelliJ Ultimate 2021.3.2, Cursive 1.12.1-2021.3

jeff303 avatar Mar 25 '22 19:03 jeff303