Trying to make readline timeout

This commit is contained in:
Eugene Yokota 2016-08-08 01:11:33 -04:00
parent d760b15193
commit bc32cb4c6f
1 changed files with 16 additions and 0 deletions

View File

@ -140,6 +140,22 @@ private[sbt] class InputStreamWrapper(is: InputStream, val poll: Duration) exten
Thread.sleep(poll.toMillis)
read()
}
@tailrec
final override def read(b: Array[Byte]): Int =
if (is.available() != 0) is.read(b)
else {
Thread.sleep(poll.toMillis)
read(b)
}
@tailrec
final override def read(b: Array[Byte], off: Int, len: Int): Int =
if (is.available() != 0) is.read(b, off, len)
else {
Thread.sleep(poll.toMillis)
read(b, off, len)
}
}
trait LineReader {