Merge pull request #5854 from eatkins/jline-reader

Use DumbTerminal if sbt.log.noformat=true
This commit is contained in:
eugene yokota 2020-09-15 16:45:04 -04:00 committed by GitHub
commit 3bee2cff9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -75,7 +75,7 @@ private[sbt] object JLine3 {
}
}
private[sbt] def apply(term: Terminal): JTerminal = {
if (System.getProperty("jline.terminal", "") == "none")
if (System.getProperty("jline.terminal", "") == "none" || !Terminal.formatEnabledInEnv)
new DumbTerminal(term.inputStream, term.outputStream)
else wrapTerminal(term)
}

View File

@ -768,14 +768,17 @@ object Terminal {
// older Scala, since it shaded classes but not the system property
private[this] def fixTerminalProperty(): Unit = {
val terminalProperty = "jline.terminal"
val newValue = System.getProperty(terminalProperty) match {
case "jline.UnixTerminal" => "unix"
case null if System.getProperty("sbt.cygwin") != null => "unix"
case "jline.WindowsTerminal" => "windows"
case "jline.AnsiWindowsTerminal" => "windows"
case "jline.UnsupportedTerminal" => "none"
case x => x
}
val newValue =
if (!formatEnabledInEnv) "none"
else
System.getProperty(terminalProperty) match {
case "jline.UnixTerminal" => "unix"
case null if System.getProperty("sbt.cygwin") != null => "unix"
case "jline.WindowsTerminal" => "windows"
case "jline.AnsiWindowsTerminal" => "windows"
case "jline.UnsupportedTerminal" => "none"
case x => x
}
if (newValue != null) {
System.setProperty(terminalProperty, newValue)
()