mirror of https://github.com/sbt/sbt.git
Fix Logger to work when jline is not available
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@858 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
4dfdf5d356
commit
39573225d1
|
|
@ -640,7 +640,7 @@ object FileUtilities
|
|||
if(charset.newEncoder.canEncode(content))
|
||||
write(file, charset, append, log) { w => w.write(content); None }
|
||||
else
|
||||
Some("String cannot be encoded by default charset.")
|
||||
Some("String cannot be encoded by charset " + charset.name)
|
||||
}
|
||||
|
||||
/** Opens a <code>Writer</code> on the given file using the default encoding,
|
||||
|
|
|
|||
|
|
@ -248,9 +248,15 @@ final class BufferedLogger(delegate: Logger) extends Logger
|
|||
|
||||
object ConsoleLogger
|
||||
{
|
||||
private[this] def formatExplicitlyDisabled = java.lang.Boolean.getBoolean("sbt.log.noformat")
|
||||
private[this] def ansiSupported = jline.Terminal.getTerminal.isANSISupported
|
||||
private val formatEnabled = ansiSupported && !formatExplicitlyDisabled
|
||||
|
||||
private[this] def formatExplicitlyDisabled = java.lang.Boolean.getBoolean("sbt.log.noformat")
|
||||
private[this] def ansiSupported =
|
||||
try { jline.Terminal.getTerminal.isANSISupported }
|
||||
catch { case e: Exception => !isWindows }
|
||||
|
||||
private[this] def os = System.getProperty("os.name")
|
||||
private[this] def isWindows = os.toLowerCase.indexOf("windows") >= 0
|
||||
}
|
||||
|
||||
/** A logger that logs to the console. On supported systems, the level labels are
|
||||
|
|
|
|||
Loading…
Reference in New Issue