Trying to make readline timeout

This commit is contained in:
Eugene Yokota 2016-08-08 01:11:33 -04:00 committed by Dale Wijnand
parent 414a7bb5f7
commit 43215db815
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
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 {