1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-30 19:40:37 +01:00

Exit with non-zero exit code when killed by watchdog ()

This commit is contained in:
Jason Penilla 2021-05-28 00:29:41 -07:00
parent 8c6e42583a
commit e278cc1a3a

View file

@ -100,6 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot end
+ public volatile Thread shutdownThread; // Paper
+ public volatile boolean abnormalExit = false; // Paper
+
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
@ -261,10 +262,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
//this.remoteStatusListener.b(); // Paper - don't wait for remote connections
}
- System.exit(0); // CraftBukkit
+ hasFullyShutdown = true; // Paper
System.exit(0); // CraftBukkit
+ System.exit(this.abnormalExit ? 70 : 0); // CraftBukkit // Paper
}
@Override
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@Override
public void stop() {
@ -579,6 +582,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ RestartCommand.addShutdownHook( SpigotConfig.restartScript );
+ }
+ // try one last chance to safe shutdown on main incase it 'comes back'
+ server.abnormalExit = true;
+ server.safeShutdown(false, restart);
+ try {
+ Thread.sleep(1000);