Fix console echo for windows batch commands

For reasons I don't fully understand, it is necessary to go in and out
of raw mode to get console input to echo on windows. This was reported
as sbt new not echoing input in #5952.
This commit is contained in:
Ethan Atkins 2020-10-24 09:45:01 -07:00
parent 7a3ca0d9c2
commit 46c5f8b0d8
1 changed files with 6 additions and 0 deletions

View File

@ -796,6 +796,12 @@ object Terminal {
private[util] val system: org.jline.terminal.Terminal,
) extends TerminalImpl(in, out, originalErr, "console0") {
private[this] val rawMode = new AtomicBoolean(false)
if (Util.isWindows && hasConsole) {
// It is necessary to enter and exit raw mode in order to get the windows
// console to echo input.
enterRawMode()
exitRawMode()
}
override private[sbt] def getSizeImpl: (Int, Int) = {
val size = system.getSize
(size.getColumns, size.getRows)