From 54f8ef8352f468f9886875633a328793098116c2 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Mon, 21 Sep 2020 16:03:19 -0700 Subject: [PATCH] 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. --- .../src/main/scala/sbt/internal/util/Terminal.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala b/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala index 597c3950b..18f5f2b77 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala @@ -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