Merge pull request #5966 from eatkins/piped-output-fix

Remove ansi control characters from piped output
This commit is contained in:
eugene yokota 2020-10-10 20:13:39 -04:00 committed by GitHub
commit aec55af083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -91,9 +91,9 @@ private[sbt] final class ProgressState(
printStream: PrintStream,
hasProgress: Boolean
): Unit = {
val canClearPrompt = currentLineBytes.get.isEmpty
addBytes(terminal, bytes)
if (hasProgress) {
val canClearPrompt = currentLineBytes.get.isEmpty
addBytes(terminal, bytes)
val toWrite = new ArrayBuffer[Byte]
terminal.prompt match {
case a: Prompt.AskUser if a.render.nonEmpty && canClearPrompt =>

View File

@ -331,7 +331,7 @@ object Terminal {
private[sbt] def withStreams[T](isServer: Boolean)(f: => T): T =
// In ci environments, don't touch the io streams unless run with -Dsbt.io.virtual=true
if (System.getProperty("sbt.io.virtual", "") == "true" || (logFormatEnabled.getOrElse(true) && !isCI)) {
hasProgress.set(isServer)
hasProgress.set(isServer && formatEnabledInEnv)
consoleTerminalHolder.set(newConsoleTerminal())
activeTerminal.set(consoleTerminalHolder.get)
try withOut(withIn(f))