shutdown cleanly on exit

pull/4/head
Zlatin Balevsky 2019-06-05 12:38:56 +01:00
parent e2f92c5c5e
commit 9008fac24d
1 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,11 @@ class Cli {
def toShare = it.readLine()
core.eventBus.publish(new FileSharedEvent(file : new File(toShare)))
}
Runtime.getRuntime().addShutdownHook({
println "shutting down.."
core.shutdown()
println "shutdown."
})
Thread.sleep(Integer.MAX_VALUE)
}
}