From 3aeede3774b4cf6d41ef04f52e9e4e9573bf6e9e Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sat, 24 Oct 2020 15:37:39 -0700 Subject: [PATCH] Flush terminal output stream after readline With the thin client, when running the command `exit`, it is often the case that the log message `[info] disconnected` is printed on the same line as the prompt. This is because there is a small flush delay on the network client's output stream channel that causes the disconnected info message to be logged before the the newline that jline 3 echoes to the client has been printed. To fix this we can manually flush the terminal output stream before exiting. --- main/src/main/scala/sbt/internal/server/NetworkChannel.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/main/src/main/scala/sbt/internal/server/NetworkChannel.scala b/main/src/main/scala/sbt/internal/server/NetworkChannel.scala index 5168b55bf..7df83c092 100644 --- a/main/src/main/scala/sbt/internal/server/NetworkChannel.scala +++ b/main/src/main/scala/sbt/internal/server/NetworkChannel.scala @@ -565,6 +565,7 @@ final class NetworkChannel( logShutdown: Boolean, remainingCommands: Option[(String, String)] ): Unit = { + doFlush() terminal.close() StandardMain.exchange.removeChannel(this) super.shutdown(logShutdown)