Reset jline on exit

The console input did not work correctly after a reboot because the
console was still reading from System.in.
This commit is contained in:
Ethan Atkins 2020-06-27 12:30:29 -07:00
parent 77b1e38e41
commit eb66906dad
1 changed files with 6 additions and 2 deletions

View File

@ -261,7 +261,11 @@ object Terminal {
*/
private[sbt] def withStreams[T](f: => T): T =
if (System.getProperty("sbt.io.virtual", "true") == "true") {
withOut(withIn(f))
try withOut(withIn(f))
finally {
jline.TerminalFactory.reset()
console.close()
}
} else f
private[this] object ProxyTerminal extends Terminal {
@ -355,7 +359,7 @@ object Terminal {
latch.countDown()
buffer.size
}
override def close(): Unit = {
override def close(): Unit = if (closed.compareAndSet(false, true)) {
executor.shutdownNow()
()
}