Should fix 'Never get to here'

This commit is contained in:
huangyuhui
2018-06-08 13:55:38 +08:00
parent e9070a77c3
commit 110b7cb06f
3 changed files with 10 additions and 10 deletions

View File

@@ -109,7 +109,13 @@ public final class LauncherHelper {
.then(Task.of(Schedulers.javafx(), () -> emitStatus(LoadingState.LAUNCHING)))
.then(Task.of(variables -> {
variables.set("launcher", new HMCLGameLauncher(
repository, selectedVersion, variables.get("account"), setting.toLaunchOptions(profile.getGameDir()), new HMCLProcessListener(variables.get("account"), setting, gameVersion.isPresent())
repository,
selectedVersion,
variables.get("account"),
setting.toLaunchOptions(profile.getGameDir()),
setting.getLauncherVisibility() == LauncherVisibility.CLOSE
? null // Unnecessary to start listening to game process output when close launcher immediately after game launched.
: new HMCLProcessListener(variables.get("account"), setting, gameVersion.isPresent())
));
}))
.then(variables -> {

View File

@@ -115,7 +115,8 @@ public final class Controllers {
}
public static void dialog(Region content) {
decorator.showDialog(content);
if (decorator != null)
decorator.showDialog(content);
}
public static void dialog(String text) {

View File

@@ -273,9 +273,7 @@ public class DefaultLauncher extends Launcher {
}
ManagedProcess p = new ManagedProcess(process, rawCommandLine);
if (listener == null)
startMonitors(p);
else
if (listener != null)
startMonitors(p, listener, daemon);
return p;
}
@@ -313,11 +311,6 @@ public class DefaultLauncher extends Launcher {
throw new PermissionException();
}
private void startMonitors(ManagedProcess managedProcess) {
managedProcess.addRelatedThread(Lang.thread(new StreamPump(managedProcess.getProcess().getInputStream()), "stdout-pump", true));
managedProcess.addRelatedThread(Lang.thread(new StreamPump(managedProcess.getProcess().getErrorStream()), "stderr-pump", true));
}
private void startMonitors(ManagedProcess managedProcess, ProcessListener processListener) {
startMonitors(managedProcess, processListener, true);
}