mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
cli: also halt on LastErrorException
This commit is contained in:
parent
2f3f79dfcd
commit
ad4fd8b37f
@ -13,6 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.terminal.cli
|
||||
|
||||
import com.sun.jna.LastErrorException
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
@ -84,9 +85,9 @@ object CLI {
|
||||
line = readLine().trimWhitespaces().replace("\n", "").replace("\r", "")
|
||||
terminal.flush()
|
||||
} catch (exception: EndOfFileException) {
|
||||
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { exception.printStackTrace() }
|
||||
Log.log(LogMessageType.GENERAL, LogLevels.WARN) { "End of file error in cli thread. Disabling cli." }
|
||||
break
|
||||
eol(exception); break
|
||||
} catch (exception: LastErrorException) {
|
||||
eol(exception); break
|
||||
} catch (exception: UserInterruptException) {
|
||||
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
|
||||
break
|
||||
@ -100,6 +101,11 @@ object CLI {
|
||||
}
|
||||
}
|
||||
|
||||
private fun eol(exception: Throwable) {
|
||||
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { exception.printStackTrace() }
|
||||
Log.log(LogMessageType.GENERAL, LogLevels.WARN) { "End of file error in cli thread. Disabling cli." }
|
||||
}
|
||||
|
||||
private fun processLine(line: String) {
|
||||
try {
|
||||
ROOT_NODE.execute(line, connection)
|
||||
|
Loading…
x
Reference in New Issue
Block a user