mirror of https://github.com/sbt/sbt.git
Give an explanation in case of ServerAlreadyBootingException (#6353)
Give and explanation in case of ServerAlreadyBootingException
This commit is contained in:
parent
5f24664c0d
commit
81457e60ec
|
|
@ -345,7 +345,7 @@ public class BootServerSocket implements AutoCloseable {
|
||||||
: new UnixDomainServerSocket(name, jni);
|
: new UnixDomainServerSocket(name, jni);
|
||||||
return socket;
|
return socket;
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new ServerAlreadyBootingException();
|
throw new ServerAlreadyBootingException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,11 @@
|
||||||
|
|
||||||
package sbt.internal;
|
package sbt.internal;
|
||||||
|
|
||||||
public class ServerAlreadyBootingException extends Exception {}
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ServerAlreadyBootingException extends Exception {
|
||||||
|
|
||||||
|
public ServerAlreadyBootingException(IOException e) {
|
||||||
|
super(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,11 @@ private[sbt] object xMain {
|
||||||
): (Option[BootServerSocket], Option[Exit]) =
|
): (Option[BootServerSocket], Option[Exit]) =
|
||||||
try (Some(new BootServerSocket(configuration)) -> None)
|
try (Some(new BootServerSocket(configuration)) -> None)
|
||||||
catch {
|
catch {
|
||||||
case _: ServerAlreadyBootingException
|
case e: ServerAlreadyBootingException
|
||||||
if System.console != null && !ITerminal.startedByRemoteClient =>
|
if System.console != null && !ITerminal.startedByRemoteClient =>
|
||||||
println("sbt server is already booting. Create a new server? y/n (default y)")
|
println(
|
||||||
|
s"sbt thinks that server is already booting because of this exception:\n${e.getCause}\nCreate a new server? y/n (default y)"
|
||||||
|
)
|
||||||
val exit = ITerminal.get.withRawInput(System.in.read) match {
|
val exit = ITerminal.get.withRawInput(System.in.read) match {
|
||||||
case 110 => Some(Exit(1))
|
case 110 => Some(Exit(1))
|
||||||
case _ => None
|
case _ => None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue