mirror of https://github.com/sbt/sbt.git
Fix for #4191 (active.json should be removed on JVM shutdown)
Added a shutdown hook to clean up active.json file
This commit is contained in:
parent
17f5bc149e
commit
e465aee36a
|
|
@ -105,11 +105,18 @@ object StandardMain {
|
||||||
import scalacache.caffeine._
|
import scalacache.caffeine._
|
||||||
private[sbt] lazy val cache: Cache[Any] = CaffeineCache[Any]
|
private[sbt] lazy val cache: Cache[Any] = CaffeineCache[Any]
|
||||||
|
|
||||||
|
private[sbt] val shutdownHook = new Thread(new Runnable {
|
||||||
|
def run(): Unit = {
|
||||||
|
exchange.shutdown
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
def runManaged(s: State): xsbti.MainResult = {
|
def runManaged(s: State): xsbti.MainResult = {
|
||||||
val previous = TrapExit.installManager()
|
val previous = TrapExit.installManager()
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
Runtime.getRuntime.addShutdownHook(shutdownHook)
|
||||||
MainLoop.runLogged(s)
|
MainLoop.runLogged(s)
|
||||||
} finally exchange.shutdown
|
} finally exchange.shutdown
|
||||||
} finally DefaultBackgroundJobService.backgroundJobService.shutdown()
|
} finally DefaultBackgroundJobService.backgroundJobService.shutdown()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue