mirror of https://github.com/sbt/sbt.git
Merge pull request #6999 from eed3si9n/bport/6994
[1.8.x] add output when boot server socket fails to create
This commit is contained in:
commit
e05acf9ca1
|
|
@ -141,23 +141,31 @@ private[sbt] object xMain {
|
|||
|
||||
private def getSocketOrExit(
|
||||
configuration: xsbti.AppConfiguration
|
||||
): (Option[BootServerSocket], Option[Exit]) =
|
||||
try (Some(new BootServerSocket(configuration)) -> None)
|
||||
): (Option[BootServerSocket], Option[Exit]) = {
|
||||
def printThrowable(e: Throwable): Unit = {
|
||||
println("sbt thinks that server is already booting because of this exception:")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
try Some(new BootServerSocket(configuration)) -> None
|
||||
catch {
|
||||
case e: ServerAlreadyBootingException
|
||||
if System.console != null && !ITerminal.startedByRemoteClient =>
|
||||
println("sbt thinks that server is already booting because of this exception:")
|
||||
e.printStackTrace()
|
||||
printThrowable(e)
|
||||
println("Create a new server? y/n (default y)")
|
||||
val exit =
|
||||
if (ITerminal.get.withRawInput(System.in.read) == 'n'.toInt) Some(Exit(1))
|
||||
else None
|
||||
(None, exit)
|
||||
case _: ServerAlreadyBootingException =>
|
||||
case e: ServerAlreadyBootingException =>
|
||||
if (SysProp.forceServerStart) (None, None)
|
||||
else (None, Some(Exit(2)))
|
||||
else {
|
||||
printThrowable(e)
|
||||
(None, Some(Exit(2)))
|
||||
}
|
||||
case _: UnsatisfiedLinkError => (None, None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class ScriptMain extends xsbti.AppMain {
|
||||
|
|
|
|||
Loading…
Reference in New Issue