Enable ansi codes if supershell is enabled

Running sbt with -Dsbt.supershell=true and -Dsbt.color=true doesn't work
well because the isAnsiSupported flag is set to false when
-Dsbt.color=false. This causes the processing that ensures that
supershell lines do not get interleaved with normal log lines to be
skipped. To fix this, we can enable ansi codes when supershell is
explicitly enabled.
This commit is contained in:
Ethan Atkins 2020-10-20 11:51:52 -07:00
parent 78620cd902
commit 3d179cda75
1 changed files with 2 additions and 1 deletions

View File

@ -306,8 +306,9 @@ object Terminal {
case _ => sys.props.get("sbt.log.format").flatMap(parseLogOption)
}
}
private[this] lazy val superShellEnabled = sys.props.get("sbt.supershell").map(_ == "true")
private[sbt] lazy val isAnsiSupported: Boolean =
logFormatEnabled.getOrElse(useColorDefault && !isCI)
logFormatEnabled.orElse(superShellEnabled).getOrElse(useColorDefault && !isCI)
private[this] val isDumbTerminal = "dumb" == System.getenv("TERM")
private[this] val hasConsole = Option(java.lang.System.console).isDefined
private[this] def useColorDefault: Boolean = {