Ensure no progress stuff if printed...

after progress report is stopped

just in case
This commit is contained in:
Alexandre Archambault 2017-02-21 15:57:39 +01:00
parent 21ba9888a5
commit a84057f792
2 changed files with 8 additions and 3 deletions

View File

@ -162,6 +162,7 @@ lazy val cache = project
import com.typesafe.tools.mima.core._
Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.TermDisplay#UpdateDisplayRunnable.cleanDisplay"),
ProblemFilters.exclude[FinalClassProblem]("coursier.TermDisplay$DownloadInfo"),
ProblemFilters.exclude[FinalClassProblem]("coursier.TermDisplay$CheckUpdateInfo"),
ProblemFilters.exclude[FinalClassProblem]("coursier.util.Base64$B64Scheme"),

View File

@ -173,6 +173,8 @@ object TermDisplay {
private var currentHeight = 0
private var printedAnything0 = false
private var stopped = false
def printedAnything() = printedAnything0
private val needsUpdate = new AtomicBoolean(false)
@ -286,7 +288,7 @@ object TermDisplay {
}
private def updateDisplay(): Unit =
if (needsUpdate.getAndSet(false)) {
if (!stopped && needsUpdate.getAndSet(false)) {
val (done0, downloads0) = downloads.synchronized {
val q = doneQueue
.toVector
@ -341,7 +343,7 @@ object TermDisplay {
currentHeight = downloads0.length
}
def cleanDisplay(): Unit = {
def stop(): Unit = {
for (_ <- 1 to 2; _ <- 0 until currentHeight) {
out.clearLine(2)
out.down(1)
@ -350,6 +352,8 @@ object TermDisplay {
out.up(2)
out.flush()
stopped = true
}
private var previous = Set.empty[String]
@ -456,7 +460,7 @@ class TermDisplay(
def stopDidPrintSomething(): Boolean = {
scheduler.shutdown()
scheduler.awaitTermination(2 * refreshInterval, TimeUnit.MILLISECONDS)
updateRunnable.cleanDisplay()
updateRunnable.stop()
updateRunnable.printedAnything()
}