Merge pull request #7280 from andrzejressel/sbt_echo

Cache echoEnabled
This commit is contained in:
eugene yokota 2023-06-03 18:46:37 -04:00 committed by GitHub
commit 8ef1f9cad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -874,13 +874,19 @@ object Terminal {
override lazy val isAnsiSupported: Boolean =
!isDumbTerminal && Terminal.isAnsiSupported && !isCI
override private[sbt] def progressState: ProgressState = consoleProgressState.get
override def isEchoEnabled: Boolean =
try system.echo()
catch { case _: InterruptedIOException => false }
override def isSuccessEnabled: Boolean = true
private lazy val echoEnabled: AtomicBoolean = new AtomicBoolean({
try system.echo()
catch {
case _: InterruptedIOException => false
}
})
override def isEchoEnabled: Boolean = echoEnabled.get()
override def setEchoEnabled(toggle: Boolean): Unit =
try Util.ignoreResult(system.echo(toggle))
catch { case _: InterruptedIOException => }
try {
Util.ignoreResult(system.echo(toggle))
echoEnabled.set(toggle)
} catch { case _: InterruptedIOException => }
override def getBooleanCapability(capability: String): Boolean =
capabilityMap.get(capability).fold(false)(system.getBooleanCapability)
override def getNumericCapability(capability: String): Integer =