mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Фикс работы WriteParamsThread
This commit is contained in:
parent
24987bac6c
commit
65d47295bc
1 changed files with 9 additions and 2 deletions
|
@ -295,6 +295,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl
|
||||||
|
|
||||||
private static Process process = null;
|
private static Process process = null;
|
||||||
private static boolean clientStarted = false;
|
private static boolean clientStarted = false;
|
||||||
|
private static Thread writeParamsThread;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static Process launch(
|
public static Process launch(
|
||||||
|
@ -304,7 +305,11 @@ public static Process launch(
|
||||||
LogHelper.debug("Writing ClientLauncher params");
|
LogHelper.debug("Writing ClientLauncher params");
|
||||||
ClientLauncherContext context = new ClientLauncherContext();
|
ClientLauncherContext context = new ClientLauncherContext();
|
||||||
clientStarted = false;
|
clientStarted = false;
|
||||||
CommonHelper.newThread("Client params writter", true, () ->
|
if(writeParamsThread != null && writeParamsThread.isAlive())
|
||||||
|
{
|
||||||
|
writeParamsThread.interrupt();
|
||||||
|
}
|
||||||
|
writeParamsThread = CommonHelper.newThread("Client params writter", true, () ->
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
try (ServerSocket socket = new ServerSocket()) {
|
try (ServerSocket socket = new ServerSocket()) {
|
||||||
|
@ -333,7 +338,8 @@ public static Process launch(
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
|
writeParamsThread.start();
|
||||||
checkJVMBitsAndVersion();
|
checkJVMBitsAndVersion();
|
||||||
LogHelper.debug("Resolving JVM binary");
|
LogHelper.debug("Resolving JVM binary");
|
||||||
Path javaBin = LauncherGuardManager.getGuardJavaBinPath();
|
Path javaBin = LauncherGuardManager.getGuardJavaBinPath();
|
||||||
|
@ -395,6 +401,7 @@ public static Process launch(
|
||||||
{
|
{
|
||||||
int exitCode = process.exitValue();
|
int exitCode = process.exitValue();
|
||||||
LogHelper.error("Process exit code %d", exitCode);
|
LogHelper.error("Process exit code %d", exitCode);
|
||||||
|
if(writeParamsThread != null && writeParamsThread.isAlive()) writeParamsThread.interrupt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(clientStarted)
|
if(clientStarted)
|
||||||
|
|
Loading…
Reference in a new issue