From 1dcd88e709fc2f872323e9316bdd1ac07dbe0873 Mon Sep 17 00:00:00 2001 From: Christopher Schnick Date: Mon, 19 Dec 2022 21:19:44 +0100 Subject: [PATCH] More beacon server startup fixes --- beacon/src/main/java/io/xpipe/beacon/BeaconServer.java | 10 ++++++---- .../java/io/xpipe/core/util/XPipeInstallation.java | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java index e3f17d083..24df5320f 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java @@ -9,6 +9,7 @@ import io.xpipe.core.util.XPipeInstallation; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.util.List; /** * Contains basic functionality to start, communicate, and stop a remote beacon server. @@ -33,7 +34,7 @@ public class BeaconServer { ? " " + BeaconConfig.getDaemonArguments() : "")); Process process = Runtime.getRuntime().exec(command.toArray(String[]::new)); - printDaemonOutput(process, ShellTypes.getPlatformDefault().flatten(command)); + printDaemonOutput(process, command); return process; } return null; @@ -48,12 +49,13 @@ public class BeaconServer { getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments()); } - Process process = new ProcessBuilder(ShellTypes.getPlatformDefault().executeCommandListWithShell(command)).start(); - printDaemonOutput(process, command); + var fullCommand = ShellTypes.getPlatformDefault().executeCommandListWithShell(command); + Process process = new ProcessBuilder(fullCommand).start(); + printDaemonOutput(process, fullCommand); return process; } - private static void printDaemonOutput(Process proc, String command) { + private static void printDaemonOutput(Process proc, List command) { boolean print = BeaconConfig.printDaemonOutput(); if (print) { System.out.println("Starting daemon: " + command); diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index fbeb5728a..d1f8b1122 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -13,10 +13,10 @@ public class XPipeInstallation { public static String createExternalAsyncLaunchCommand(String installationBase, String arguments) { var suffix = (arguments != null ? arguments : ""); if (OsType.getLocal().equals(OsType.LINUX)) { - return "nohup \"" + installationBase + "/app/bin/xpiped\" --external & disown" + suffix; + return "nohup \"" + installationBase + "/app/bin/xpiped\" --external " + suffix + " & disown"; } - return FileNames.join(installationBase, XPipeInstallation.getDaemonExecutablePath(OsType.getLocal())) + suffix; + return "\"" + FileNames.join(installationBase, XPipeInstallation.getDaemonExecutablePath(OsType.getLocal())) + "\" " + suffix; } public static String createExternalLaunchCommand(String command, String arguments) {