mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +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 boolean clientStarted = false;
|
||||
private static Thread writeParamsThread;
|
||||
|
||||
@LauncherAPI
|
||||
public static Process launch(
|
||||
|
@ -304,7 +305,11 @@ public static Process launch(
|
|||
LogHelper.debug("Writing ClientLauncher params");
|
||||
ClientLauncherContext context = new ClientLauncherContext();
|
||||
clientStarted = false;
|
||||
CommonHelper.newThread("Client params writter", true, () ->
|
||||
if(writeParamsThread != null && writeParamsThread.isAlive())
|
||||
{
|
||||
writeParamsThread.interrupt();
|
||||
}
|
||||
writeParamsThread = CommonHelper.newThread("Client params writter", true, () ->
|
||||
{
|
||||
try {
|
||||
try (ServerSocket socket = new ServerSocket()) {
|
||||
|
@ -333,7 +338,8 @@ public static Process launch(
|
|||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
writeParamsThread.start();
|
||||
checkJVMBitsAndVersion();
|
||||
LogHelper.debug("Resolving JVM binary");
|
||||
Path javaBin = LauncherGuardManager.getGuardJavaBinPath();
|
||||
|
@ -395,6 +401,7 @@ public static Process launch(
|
|||
{
|
||||
int exitCode = process.exitValue();
|
||||
LogHelper.error("Process exit code %d", exitCode);
|
||||
if(writeParamsThread != null && writeParamsThread.isAlive()) writeParamsThread.interrupt();
|
||||
break;
|
||||
}
|
||||
if(clientStarted)
|
||||
|
|
Loading…
Reference in a new issue