Why is `lein run` not `lein trampoline`?
Asked Answered
N

1

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?

Norrisnorrv answered 2/3, 2013 at 2:58 Comment(2)
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.Virology
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.Psychedelic
A
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.

Alidaalidade answered 2/4, 2013 at 2:18 Comment(2)
Maybe, I'm dumb, but in which way does this answer the original question?Bloomfield
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".Alidaalidade

© 2022 - 2024 — McMap. All rights reserved.