From 1e2ef146393c1a85f6ee6bc71f70078e3bc0ce39 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 26 Aug 2020 08:14:24 +0800 Subject: [PATCH] Use consoleLogger instead of stdout --- .../kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt index 443ef22c3..941870f77 100644 --- a/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt +++ b/frontend/mirai-console-pure/src/main/kotlin/net/mamoe/mirai/console/pure/ConsoleThread.kt @@ -25,7 +25,6 @@ import org.fusesource.jansi.Ansi import org.jline.reader.UserInterruptException import java.util.* import kotlin.concurrent.thread -import kotlin.system.exitProcess @OptIn(ConsoleInternalAPI::class) internal fun startupConsoleThread() { @@ -33,7 +32,6 @@ internal fun startupConsoleThread() { ConsoleUtils.miraiLineReader = { hint -> mutex.withLock { withContext(Dispatchers.IO) { - println("Requesting input") ConsoleUtils.lineReader.readLine( if (hint.isNotEmpty()) { ConsoleUtils.lineReader.printAbove( @@ -64,7 +62,6 @@ internal fun startupConsoleThread() { else -> CommandManager.commandPrefix + it } } - exitProcess(123456) if (next.isBlank()) { continue } @@ -74,7 +71,7 @@ internal fun startupConsoleThread() { CommandExecuteStatus.SUCCESSFUL -> { } CommandExecuteStatus.EXECUTION_EXCEPTION -> { - result.exception?.printStackTrace() + result.exception?.let(consoleLogger::error) } CommandExecuteStatus.COMMAND_NOT_FOUND -> { consoleLogger.warning("未知指令: ${result.commandName}, 输入 ? 获取帮助")