Revert back to non-blocking watch termination condition

A thread blocking on System.in.read() cannot be interrupted, so check
System.in.available before blocking. This is how it used to work. It
requires https://github.com/sbt/io/pull/149 or else a cpu will be
pegged by the EventMonitor user input thread spinning on
System.in.available.
This commit is contained in:
Ethan Atkins 2018-05-08 13:18:13 -07:00
parent 68c984a66d
commit d3ac5274b3
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ object Watched {
def executeContinuously(watched: Watched, s: State, next: String, repeat: String): State = {
@tailrec def shouldTerminate: Boolean =
watched.terminateWatch(System.in.read()) || shouldTerminate
(System.in.available > 0) && (watched.terminateWatch(System.in.read()) || shouldTerminate)
val log = s.log
val logger = new EventMonitor.Logger {
override def debug(msg: => Any): Unit = log.debug(msg.toString)