Stop input on CancellationException

This commit is contained in:
Him188 2020-08-23 19:52:24 +08:00
parent 33f6a9aff1
commit d2b7421df7

View File

@ -47,7 +47,7 @@ internal fun startupConsoleThread() {
} }
} }
CoroutineScope(dispatch + SupervisorJob()).launch { MiraiConsole.launch(dispatch) {
val consoleLogger = DefaultLogger("console") val consoleLogger = DefaultLogger("console")
while (isActive) { while (isActive) {
try { try {
@ -78,6 +78,8 @@ internal fun startupConsoleThread() {
} }
} catch (e: InterruptedException) { } catch (e: InterruptedException) {
return@launch return@launch
} catch (e: CancellationException) {
return@launch
} catch (e: Throwable) { } catch (e: Throwable) {
consoleLogger.error("Unhandled exception", e) consoleLogger.error("Unhandled exception", e)
} }