mirai console shutdown logic

This commit is contained in:
jiahua.liu 2020-02-17 17:00:20 +08:00
parent e284267d47
commit 9828bbf694
2 changed files with 8 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class MiraiConsoleTerminalLoader {
}
Runtime.getRuntime().addShutdownHook(thread(start = false) {
MiraiConsole.stop()
MiraiConsoleTerminalUI.exit()
})
}
}

View File

@ -353,7 +353,7 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
emptyCommand()
}
KeyType.Escape -> {
exitProcess(0)
exit()
}
else -> {
if (keyStroke.character != null) {
@ -649,6 +649,12 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
}
redrawLogs(log[screens[currentScreenId]]!!)
}
fun exit() {
terminal.exitPrivateMode()
terminal.close()
exitProcess(0)
}
}