diff --git a/util/complete/LineReader.scala b/util/complete/LineReader.scala index a48e4c141..1318061af 100644 --- a/util/complete/LineReader.scala +++ b/util/complete/LineReader.scala @@ -53,8 +53,9 @@ abstract class JLine extends LineReader } private object JLine { - def terminal = jline.Terminal.getTerminal - def resetTerminal() = withTerminal { _ => jline.Terminal.resetTerminal } + // When calling this, ensure that enableEcho has been or will be called. + // getTerminal will initialize the terminal to disable echo. + private def terminal = jline.Terminal.getTerminal private def withTerminal[T](f: jline.Terminal => T): T = synchronized { diff --git a/util/log/ConsoleLogger.scala b/util/log/ConsoleLogger.scala index a453b3b8a..ad626336f 100644 --- a/util/log/ConsoleLogger.scala +++ b/util/log/ConsoleLogger.scala @@ -35,8 +35,13 @@ object ConsoleLogger } private[this] def ansiSupported = - try { jline.Terminal.getTerminal.isANSISupported } - catch { case e: Exception => !isWindows } + try { + val terminal = jline.Terminal.getTerminal + terminal.enableEcho() // #460 + terminal.isANSISupported + } catch { + case e: Exception => !isWindows + } private[this] def os = System.getProperty("os.name") private[this] def isWindows = os.toLowerCase.indexOf("windows") >= 0