Console wrapper must wait until process exited if ctrl-c is pressed
Brought to you by:
grzegok
Console wrapper must wait until process is exit when Ctrl-C is pressed.
Example (in kotlin):
import kotlin.concurrent.thread
fun main() {
val thread = Thread.currentThread()
Runtime.getRuntime().addShutdownHook(thread(false) {
println("waiting")
thread.join()
println("done")
})
Thread.sleep(10_000)
println("exiting")
}
Attachments explains better.