Skip to content

Commit 2d00c69

Browse files
authored
Merge pull request sbt#6994 from devin-fisher/develop
add output when boot server socket fails to create
2 parents 4de480f + 1570302 commit 2d00c69

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

main/src/main/scala/sbt/Main.scala

+14-6
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,31 @@ private[sbt] object xMain {
141141

142142
private def getSocketOrExit(
143143
configuration: xsbti.AppConfiguration
144-
): (Option[BootServerSocket], Option[Exit]) =
145-
try (Some(new BootServerSocket(configuration)) -> None)
144+
): (Option[BootServerSocket], Option[Exit]) = {
145+
def printThrowable(e: Throwable): Unit = {
146+
println("sbt thinks that server is already booting because of this exception:")
147+
e.printStackTrace()
148+
}
149+
150+
try Some(new BootServerSocket(configuration)) -> None
146151
catch {
147152
case e: ServerAlreadyBootingException
148153
if System.console != null && !ITerminal.startedByRemoteClient =>
149-
println("sbt thinks that server is already booting because of this exception:")
150-
e.printStackTrace()
154+
printThrowable(e)
151155
println("Create a new server? y/n (default y)")
152156
val exit =
153157
if (ITerminal.get.withRawInput(System.in.read) == 'n'.toInt) Some(Exit(1))
154158
else None
155159
(None, exit)
156-
case _: ServerAlreadyBootingException =>
160+
case e: ServerAlreadyBootingException =>
157161
if (SysProp.forceServerStart) (None, None)
158-
else (None, Some(Exit(2)))
162+
else {
163+
printThrowable(e)
164+
(None, Some(Exit(2)))
165+
}
159166
case _: UnsatisfiedLinkError => (None, None)
160167
}
168+
}
161169
}
162170

163171
final class ScriptMain extends xsbti.AppMain {

0 commit comments

Comments
 (0)