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.
This commit is contained in:
Ethan Atkins 2020-11-25 13:16:34 -08:00
parent d46d5dfff5
commit c24e7da844
1 changed files with 1 additions and 1 deletions

View File

@ -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 {