mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 17:37:58 -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
|
package de.bixilon.minosoft.terminal.cli
|
||||||
|
|
||||||
|
import com.sun.jna.LastErrorException
|
||||||
import de.bixilon.kutil.latch.AbstractLatch
|
import de.bixilon.kutil.latch.AbstractLatch
|
||||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||||
@ -84,9 +85,9 @@ object CLI {
|
|||||||
line = readLine().trimWhitespaces().replace("\n", "").replace("\r", "")
|
line = readLine().trimWhitespaces().replace("\n", "").replace("\r", "")
|
||||||
terminal.flush()
|
terminal.flush()
|
||||||
} catch (exception: EndOfFileException) {
|
} catch (exception: EndOfFileException) {
|
||||||
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { exception.printStackTrace() }
|
eol(exception); break
|
||||||
Log.log(LogMessageType.GENERAL, LogLevels.WARN) { "End of file error in cli thread. Disabling cli." }
|
} catch (exception: LastErrorException) {
|
||||||
break
|
eol(exception); break
|
||||||
} catch (exception: UserInterruptException) {
|
} catch (exception: UserInterruptException) {
|
||||||
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
|
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
|
||||||
break
|
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) {
|
private fun processLine(line: String) {
|
||||||
try {
|
try {
|
||||||
ROOT_NODE.execute(line, connection)
|
ROOT_NODE.execute(line, connection)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user