shutdown hook doesn't fire when running with “lein run”

后端 未结 1 2019
广开言路
广开言路 2021-02-07 07:52

I have the following code:

(ns test-hook.core)

(defn -main []
  (.addShutdownHook (Runtime/getRuntime) (Thread. #(print         


        
相关标签:
1条回答
  • 2021-02-07 08:22

    Have you tried running it with trampoline?

    lein trampoline run
    

    Seems to work for me.

    AFAIK "lein trampoline" doesn't nest the JVM, so your Ctrl-C isn't caught by leiningen, but by your code.

    0 讨论(0)
提交回复
热议问题