mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2025-03-09 10:35:51 +01:00
handle when the user runs the app instead of clicking on systemtray
This commit is contained in:
parent
326da504ea
commit
e2c4b4cb57
@ -1,7 +1,10 @@
|
||||
package ir.armor.tachidesk.server.util
|
||||
|
||||
import mu.KotlinLogging
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
enum class ExitCode(val code: Int) {
|
||||
Success(0),
|
||||
MutexCheckFailedTachideskRunning(1),
|
||||
@ -9,5 +12,7 @@ enum class ExitCode(val code: Int) {
|
||||
}
|
||||
|
||||
fun shutdownApp(exitCode: ExitCode) {
|
||||
logger.info("Shutting Down Tachidesk. Goodbye!")
|
||||
|
||||
exitProcess(exitCode.code)
|
||||
}
|
||||
|
@ -59,11 +59,17 @@ object AppMutex {
|
||||
logger.info("Mutex status is clear, Resuming startup.")
|
||||
}
|
||||
TachideskInstanceRunning -> {
|
||||
logger.info("Another instance of Tachidesk is running on $appIP:${serverConfig.port}, Aborting.")
|
||||
logger.info("Another instance of Tachidesk is running on $appIP:${serverConfig.port}")
|
||||
|
||||
logger.info("Probably user thought tachidesk is closed so, opening webUI in browser again.")
|
||||
openInBrowser()
|
||||
|
||||
logger.info("Aborting startup.")
|
||||
|
||||
shutdownApp(ExitCode.MutexCheckFailedTachideskRunning)
|
||||
}
|
||||
OtherApplicationRunning -> {
|
||||
logger.error("A non Tachidesk application is running on $appIP:${serverConfig.port}, Aborting.")
|
||||
logger.error("A non Tachidesk application is running on $appIP:${serverConfig.port}, aborting startup.")
|
||||
shutdownApp(ExitCode.MutexCheckFailedAnotherAppRunning)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user