Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add .destroy shutdown hook for each subprocess spawned. Fixes #455.

  • Loading branch information...
commit e83da99f8ca8e90ae870a34caa55388b685b9536 1 parent c4be36c
@technomancy authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  src/leiningen/compile.clj
2  src/leiningen/compile.clj
@@ -181,6 +181,8 @@
;; doesn't let you stream out/err
(defn sh [& cmd]
(let [proc (.exec (Runtime/getRuntime) (into-array cmd))]
+ (.addShutdownHook (Runtime/getRuntime)
+ (Thread. (fn [] (.destroy proc))))
(with-open [out (reader (.getInputStream proc))
err (reader (.getErrorStream proc))]
(let [pump-out (doto (Thread. #(pump out *out*)) .start)

4 comments on commit e83da99


@trptcolin Can you run by me again why you used process-handling-sh in the master branch rather than just hard-coding the .destroy call in as here?

If it was because I mentioned something about making it easy to disable I think we can go back to the simpler approach since I suggested that when I was thinking you were going to handle it on a per-task basis rather than inside leiningen.core.eval/sh itself for some reason.


Yeah we can do it this way in master too. The only reason I did it that way was to leave the public fn sh alone just in case someone was using it to launch longer-lived processes. But I think the complexity's not worth it; I like this way unless there's evidence that people do that.


Cool; thanks for clarifying. Sorry for the miscommunication.


Sure thing, and not at all - that was a call I made separately from our IRC convo and was ambivalent about.

Please sign in to comment.
Something went wrong with that request. Please try again.