From c24e7da844c282a8e20dfd6dc82e99a965889b82 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Wed, 25 Nov 2020 13:16:34 -0800 Subject: [PATCH] Rethrow InterruptedException instead of ClosedException There are cases where sbt will incorrectly shutdown if the jline reader is interrupted while filling the input buffer. To fix this we can throw an InterruptedException instead of a ClosedException. The repro for this was start `sbt`, input `~compile` and while sbt was starting up, open a source file with vim using the metals bsp integration. sbt server would end up shutting down everytime after a single compilation iteration. --- .../util-logging/src/main/scala/sbt/internal/util/JLine3.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/JLine3.scala b/internal/util-logging/src/main/scala/sbt/internal/util/JLine3.scala index 64d84c1da..a4811a2cc 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/JLine3.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/JLine3.scala @@ -172,7 +172,7 @@ private[sbt] object JLine3 { if (buffer.isEmpty && !peek) fillBuffer() (if (peek) buffer.peek else buffer.take) match { case null => -2 - case i => if (i == -3) throw new ClosedException else i + case i => if (i == -3) throw new InterruptedException else i } } override def peek(timeout: Long): Int = buffer.peek() match {