[FIX] Переписал код использующий ProccessBuilder. Активные участники прошу работоспособность после этого коммита.

This commit is contained in:
Zaxar163 2019-11-28 18:12:40 +01:00
parent 97b30aa234
commit 358e92ad9e
No known key found for this signature in database
GPG key ID: 1FE4F2E1F053831B
2 changed files with 14 additions and 15 deletions

View file

@ -12,7 +12,6 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@ -62,8 +61,8 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_OPTDIR_PROPERTY);
if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) {
LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version"));
Collections.addAll(args, "--add-modules");
Collections.addAll(args, "javafx.base,javafx.fxml,javafx.controls,jdk.unsupported");
args.add("--add-modules");
args.add("javafx.base,javafx.fxml,javafx.controls,jdk.unsupported");
Path jvmDir = Paths.get(System.getProperty("java.home"));
String pathToFx = System.getenv("PATH_TO_FX");
Path fxPath = pathToFx == null ? null : Paths.get(pathToFx);
@ -75,17 +74,17 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
tryAddModule(findPath, "javafx.controls", builder);
String modulePath = builder.toString();
if (!modulePath.isEmpty()) {
Collections.addAll(args, "--module-path");
Collections.addAll(args, modulePath);
args.add("--module-path");
args.add(modulePath);
}
}
Collections.addAll(args, MAGIC_ARG);
Collections.addAll(args, "-XX:+DisableAttachMechanism");
Collections.addAll(args, "-Xmx256M");
args.add(MAGIC_ARG);
args.add("-XX:+DisableAttachMechanism");
args.add("-Xmx256M");
//Collections.addAll(args, "-javaagent:".concat(pathLauncher));
Collections.addAll(args, "-cp");
Collections.addAll(args, pathLauncher);
Collections.addAll(args, LauncherEngine.class.getName());
args.add("-cp");
args.add(pathLauncher);
args.add(LauncherEngine.class.getName());
LauncherEngine.modulesManager.callWrapper(processBuilder, args);
EnvHelper.addEnv(processBuilder);
LogHelper.debug("Commandline: " + args);

View file

@ -109,14 +109,14 @@ public ClientLauncherContext build() throws IOException {
// Add classpath and main class
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
context.pathLauncher = pathLauncher;
Collections.addAll(context.args, ClientLauncherWrapper.MAGIC_ARG);
context.args.add(ClientLauncherWrapper.MAGIC_ARG);
Collections.addAll(context.args, profile.getJvmArgs());
profile.pushOptionalJvmArgs(context.args);
Collections.addAll(context.args, "-Djava.library.path=".concat(params.clientDir.resolve(nativesDir).toString())); // Add Native Path
Collections.addAll(context.args, "-javaagent:".concat(pathLauncher));
context.args.add("-Djava.library.path=".concat(params.clientDir.resolve(nativesDir).toString())); // Add Native Path
context.args.add("-javaagent:".concat(pathLauncher));
ClientHookManager.clientLaunchHook.hook(context);
LauncherGuardManager.guard.addCustomParams(context);
Collections.addAll(context.args, ClientLauncher.class.getName());
context.args.add(ClientLauncher.class.getName());
ClientHookManager.clientLaunchFinallyHook.hook(context);
// Print commandline debug message