Stop continuous input thread if System.in is closed

The watch tests take forever on windows because wrapped.read() always
returns -1 during scripted.
This commit is contained in:
Ethan Atkins 2019-12-12 17:25:56 -08:00
parent 8f4d3f3f8e
commit 2f4c603be6
1 changed files with 5 additions and 2 deletions

View File

@ -288,10 +288,13 @@ private[sbt] object Continuous extends DeprecatedContinuous {
override def run(): Unit = {
try {
if (!closed.get()) {
buffer.add(wrapped.read())
wrapped.read() match {
case -1 => closed.set(true)
case b => buffer.add(b)
}
}
} catch {
case _: InterruptedException =>
case _: InterruptedException => closed.set(true)
}
if (!closed.get()) run()
}