Skip to content

Commit

Permalink
Block in shouldTerminate
Browse files Browse the repository at this point in the history
The new implementation of SourceModificationWatch.watch spins up a new
thread that listens for user input so we want to block that thread
instead of only blocking if there is input available.
  • Loading branch information
eatkins committed Apr 12, 2018
1 parent 5c2f487 commit a08cb0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions main-command/src/main/scala/sbt/Watched.scala
Expand Up @@ -92,7 +92,7 @@ object Watched {

def executeContinuously(watched: Watched, s: State, next: String, repeat: String): State = {
@tailrec def shouldTerminate: Boolean =
(System.in.available > 0) && (watched.terminateWatch(System.in.read()) || shouldTerminate)
watched.terminateWatch(System.in.read()) || shouldTerminate
val sources = watched.watchSources(s)
val service = s get ContinuousWatchService getOrElse watched.watchService()
val watchState = s get ContinuousState getOrElse WatchState.empty(service, sources)
Expand All @@ -103,7 +103,10 @@ object Watched {
val (triggered, newWatchState) =
try {
val (triggered, newWatchState) =
SourceModificationWatch.watch(watched.pollInterval, watchState)(shouldTerminate)
// TODO add key for anti-entropy
SourceModificationWatch.watch(watched.pollInterval,
watchState,
antiEntropy = 40.milliseconds)(shouldTerminate)
(triggered, newWatchState)
} catch {
case e: Exception =>
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Expand Up @@ -8,7 +8,7 @@ object Dependencies {
val baseScalaVersion = scala212

// sbt modules
private val ioVersion = "1.1.6"
private val ioVersion = "1.1.6-SNAPSHOT"
private val utilVersion = "1.1.3"
private val lmVersion = "1.1.4"
private val zincVersion = "1.1.5"
Expand Down

0 comments on commit a08cb0c

Please sign in to comment.