In a new fresh leiningen project, with its core.clj containing
(defn show-cmd
[]
(-> (shell/sh "ls")
:out
println))
(defn -main
[]
(.start (Thread. show-cmd)))
See https://gist.github.com/1183753 for the complete picture.
So, I get a RejectedExecutionException thrown when I do a lein run on the above project. The complete stack trace is in the gist.
However, the above works just fine when put in a .clj file and run directly with clojure, without leiningen in the workflow. Is this a bug in leiningen/clojure or is it just me?
If its a bug, please let me know how I can let the concerned know, as this would be the first time I’ve found a bug 🙂
Thanks.
Update Taking @skuro’s suggestion, I tried my example with the master branch clone of leiningen, but I still get the same error, as illustrated here

This is a known problem with Leiningen which unfortunately won’t be fixed soon. Fixing it would cause other stuff to break. The workaround is to force the main function to never return:
Here, since the promise is never fulfilled, main will wait forever, thus preventing Leiningen from shutting down the executors that run agents, futures, etc.