Fix prompt for task progress

This commit is contained in:
Eugene Yokota 2018-11-16 23:05:51 -08:00
parent f10455fe40
commit d58b302a97
3 changed files with 14 additions and 9 deletions

View File

@ -216,7 +216,7 @@ val completeProj = (project in file("internal") / "util-complete")
exclude[DirectMissingMethodProblem]("sbt.internal.util.complete.History.this"),
),
)
.configure(addSbtIO, addSbtUtilControl)
.configure(addSbtIO, addSbtUtilControl, addSbtUtilLogging)
// A logic with restricted negation as failure for a unique, stable model
val logicProj = (project in file("internal") / "util-logic")

View File

@ -64,16 +64,23 @@ abstract class JLine extends LineReader {
}
private[this] def handleMultilinePrompt(prompt: String): String = {
val lines = """\r?\n""".r.split(prompt)
lines.length match {
case 0 | 1 => prompt
case _ =>
val lines0 = """\r?\n""".r.split(prompt)
lines0.length match {
case 0 | 1 => handleProgress(prompt)
case _ =>
val lines = lines0.toList map handleProgress
// Workaround for regression jline/jline2#205
reader.getOutput.write(lines.init.mkString("\n") + "\n")
lines.last
}
}
private[this] def handleProgress(prompt: String): String = {
import ConsoleAppender._
if (showProgress) s"$ScrollUp$DeleteLine" + prompt
else prompt
}
private[this] def resume(): Unit = {
jline.TerminalFactory.reset
JLine.terminal.init

View File

@ -77,8 +77,6 @@ object Aggregation {
if (show.taskValues) printSettings(r, show.print)
}
if (show.success) printSuccess(start, stop, extracted, success, log)
// wait for async logger to catch up
Thread.sleep(100)
}
def timedRun[T](
@ -131,9 +129,9 @@ object Aggregation {
if (get(showSuccess)) {
if (get(showTiming)) {
val msg = timingString(start, stop, structure.data, currentRef)
if (success) log.success(msg + "\n") else log.error(msg + "\n")
if (success) log.success(msg) else log.error(msg)
} else if (success)
log.success("" + "\n")
log.success("")
}
}