Catch io errors in (enter|exit)RawMode

In a continuous build with rapid triggers, it's possible for the input
thread to be interrupted before it has completed the transition into raw
mode. This isn't a big deal because it will be reset when we enter the
next build or when we re-enter the shell.
This commit is contained in:
Ethan Atkins 2020-09-21 16:03:19 -07:00
parent 025aff625b
commit 54f8ef8352
1 changed files with 4 additions and 2 deletions

View File

@ -809,11 +809,13 @@ object Terminal {
override private[sbt] def enterRawMode(): Unit = if (rawMode.compareAndSet(false, true)) {
in.setRawMode(true)
JLine3.enterRawMode(system)
try JLine3.enterRawMode(system)
catch { case _: java.io.IOError => }
}
override private[sbt] def exitRawMode(): Unit = if (rawMode.compareAndSet(true, false)) {
in.setRawMode(false)
JLine3.exitRawMode(system)
try JLine3.exitRawMode(system)
catch { case _: java.io.IOError => }
}
override def isColorEnabled: Boolean =
props