diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt index 78a17cd26..d653c9263 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/BuiltInCommands.kt @@ -9,10 +9,7 @@ package net.mamoe.mirai.console.command -import kotlinx.coroutines.CoroutineName -import kotlinx.coroutines.cancel -import kotlinx.coroutines.cancelAndJoin -import kotlinx.coroutines.launch +import kotlinx.coroutines.* import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import net.mamoe.mirai.Bot @@ -122,8 +119,9 @@ public object BuiltInCommands { ignoreException { sendMessage("mirai-console stopped successfully.") } }, onFailure = { + if (it is CancellationException) return@fold @OptIn(ConsoleInternalAPI::class) - MiraiConsole.mainLogger.error(it) + MiraiConsole.mainLogger.error("Exception in stop", it) ignoreException { sendMessage( it.localizedMessage ?: it.message ?: it.toString()