[2.0.x] Tweak server startup message (#9430)

**Problem/Solution**
sbt 2.x uses client-server by default.
This makes the message a bit more obvious when the build is using a client.
This commit is contained in:
eugene yokota 2026-07-11 13:28:07 -04:00 committed by GitHub
parent 80f768225e
commit 3c350df583
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 8 deletions

View File

@ -182,6 +182,11 @@ class NetworkClient(
def log(level: Level.Value, message: => String): Unit = console.appendLog(level, message)
}
private val interactive = arguments.commandArguments.isEmpty
private val startupMessages: List[String] =
"entering thin client - BEEP WHIRR" ::
"starting sbt server in the background" ::
"use 'sbt shutdown' to shutdown the server" ::
" " :: Nil
private[sbt] def connectOrStartServerAndConnect(
promptCompleteUsers: Boolean,
@ -358,8 +363,9 @@ class NetworkClient(
var serverStderrFile: Option[File] = None
val process = socket match {
case None if startServer =>
if (log) console.appendLog(Level.Info, "server was not detected. starting an instance")
if log then
startupMessages.foreach: msg =>
console.appendLog(Level.Info, msg)
val props =
Seq(
term.getWidth,
@ -960,10 +966,8 @@ class NetworkClient(
catch { case _: InterruptedException => }
if (exitClean.get) 0 else 1
}
if (interactive) {
console.appendLog(Level.Info, "terminate the server with `shutdown`")
block()
} else if (exit) 0
if interactive then block()
else if exit then 0
else {
batchMode.set(true)
val res = batchExecute(userCommands.toList)

View File

@ -97,7 +97,7 @@ private[sbt] object Server {
case null =>
case s => s.close()
}
log.info(s"sbt server started at ${connection.shortName}")
log.debug(s"sbt server started at ${connection.shortName}")
writePortfile()
if (connection.bspEnabled) {
log.debug("Writing bsp connection file")

View File

@ -254,7 +254,7 @@ private[sbt] final class CommandExchange {
case Some(Success(())) =>
// remember to shutdown only when the server comes up
server = Some(serverInstance)
s.log.info("started sbt server")
s.log.debug("started sbt server")
// register this server in the shared proc directory
try {
val procDir = SysProp.globalLocalCache / "proc"