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:
veera venky 2018-06-13 03:06:30 +05:30
parent 17f5bc149e
commit e465aee36a
1 changed files with 7 additions and 0 deletions

View File

@ -105,11 +105,18 @@ object StandardMain {
import scalacache.caffeine._
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 = {
val previous = TrapExit.installManager()
try {
try {
try {
Runtime.getRuntime.addShutdownHook(shutdownHook)
MainLoop.runLogged(s)
} finally exchange.shutdown
} finally DefaultBackgroundJobService.backgroundJobService.shutdown()