Merge pull request #8057 from eed3si9n/wip/shutdown

[1.x] Shortcut sbtn shutdown
This commit is contained in:
eugene yokota 2025-03-05 22:06:50 -05:00 committed by GitHub
commit 78bffa22b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import scala.util.Try
// ThisBuild settings take lower precedence,
// but can be shared across the multi projects.
ThisBuild / version := {
val v = "1.10.10-SNAPSHOT"
val v = "1.10.11-SNAPSHOT"
nightlyVersion.getOrElse(v)
}
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"

View File

@ -153,6 +153,7 @@ class NetworkClient(
private lazy val noTab = arguments.completionArguments.contains("--no-tab")
private lazy val noStdErr = arguments.completionArguments.contains("--no-stderr") &&
!sys.env.contains("SBTN_AUTO_COMPLETE") && !sys.env.contains("SBTC_AUTO_COMPLETE")
private def shutdownOnly = arguments.commandArguments == Seq(Shutdown)
private def mkSocket(file: File): (Socket, Option[String]) = ClientSocket.socket(file, useJNI)
@ -188,7 +189,10 @@ class NetworkClient(
): (Socket, Option[String]) =
try {
if (!portfile.exists) {
if (promptCompleteUsers) {
if (shutdownOnly) {
console.appendLog(Level.Info, "no sbt server is running. ciao")
System.exit(0)
} else if (promptCompleteUsers) {
val msg = if (noTab) "" else "No sbt server is running. Press <tab> to start one..."
errorStream.print(s"\n$msg")
if (noStdErr) System.exit(0)