mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-25 03:30:15 +08:00
Do not call 'exitProcess' in console backend, but in terminal
This commit is contained in:
parent
96dced9132
commit
2dda2ff31b
@ -36,7 +36,6 @@ import java.util.*
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
||||
/**
|
||||
@ -286,14 +285,7 @@ public interface MiraiConsoleImplementation : CoroutineScope {
|
||||
}.onFailure {
|
||||
it.printStackTrace()
|
||||
}
|
||||
Thread.sleep(3000L) // 保证信息打印完成
|
||||
if (!IS_GRADLE_TEST) exitProcess(1)
|
||||
// For gradle tests, killing the JVM also kills a Gradle worker which cause './gradlew test' to fail.
|
||||
// See https://github.com/gradle/gradle/issues/11195 for more information.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmField
|
||||
internal var IS_GRADLE_TEST = false
|
@ -33,7 +33,6 @@ import kotlin.test.assertNotNull
|
||||
|
||||
@OptIn(ConsoleInternalApi::class, kotlin.io.path.ExperimentalPathApi::class)
|
||||
fun initTestEnvironment() {
|
||||
IS_GRADLE_TEST = true
|
||||
object : MiraiConsoleImplementation {
|
||||
override val rootPath: Path = createTempDirectory()
|
||||
|
||||
|
@ -47,6 +47,10 @@ object MiraiConsoleTerminalLoader {
|
||||
startAsDaemon()
|
||||
try {
|
||||
runBlocking {
|
||||
MiraiConsole.job.invokeOnCompletion {
|
||||
Thread.sleep(1000) // 保证错误信息打印完全
|
||||
exitProcess(0)
|
||||
}
|
||||
MiraiConsole.job.join()
|
||||
}
|
||||
} catch (e: CancellationException) {
|
||||
|
Loading…
Reference in New Issue
Block a user