27

It seems to me that the only difference between lein run and lein trampoline is that the latter quits Leiningen's JVM to save memory.

This seems always a good idea, so why is this feature not included in lein run and then get rid of lein trampoline?

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
Tyler Gillies
  • 1,857
  • 4
  • 22
  • 31
  • 4
    From personal experience (and I never really verified this so I might be wrong), trampoline makes it impossible to track the process using a supervising daemon, eg supervisor. – Johanna Larsson Mar 03 '13 at 08:56
  • 2
    My experience has been quite the reverse of Erik's. Using daemontools on FreeBSD, 'lein run' in the service's run script meant that 'svc -d' terminated the lein process and orphaned the child service JVM. 'lein trampoline' fixed this. Depends on the requirements of your supervisor daemon, I guess. – Danny Woods Jul 03 '13 at 13:12

1 Answers1

22

lein trampoline can be used for any leiningen task, not just lein run. For example, lein trampoline test.

Essentially, lein trampoline kills the original leiningen process so that only the actual JVM that spawns for running your Clojure stuff is alive when the task starts running. This is useful for shell scripting since killing the actual JVM won't kill the leiningen process, and vice versa.

August Lilleaas
  • 54,010
  • 13
  • 102
  • 111
  • 1
    Maybe, I'm dumb, but in which way does this answer the original question? – osxdirk Apr 08 '16 at 21:19
  • Because the "trampoline" feature is useful for more tasks than "lein run" so removing "lein trampoline" and defaulting "lein run" to behave like "lein trampoline run" today would mean you would not be able to do "lein trampoline test". – August Lilleaas Apr 12 '16 at 11:47