mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-01 09:40:35 +13:00
Small fixes
This commit is contained in:
parent
3b3f238b68
commit
0a23e950d9
2 changed files with 15 additions and 11 deletions
|
@ -1,6 +1,5 @@
|
||||||
package io.xpipe.app.storage;
|
package io.xpipe.app.storage;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
import com.fasterxml.jackson.databind.node.NullNode;
|
import com.fasterxml.jackson.databind.node.NullNode;
|
||||||
|
@ -23,8 +22,9 @@ public class DataStorageParser {
|
||||||
var mapper = JacksonMapper.newMapper();
|
var mapper = JacksonMapper.newMapper();
|
||||||
try {
|
try {
|
||||||
return mapper.treeToValue(node, DataSource.class);
|
return mapper.treeToValue(node, DataSource.class);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (Throwable e) {
|
||||||
throw new RuntimeException(e);
|
ErrorEvent.fromThrowable(e).handle();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class DataStorageParser {
|
||||||
var mapper = JacksonMapper.newMapper();
|
var mapper = JacksonMapper.newMapper();
|
||||||
try {
|
try {
|
||||||
return mapper.treeToValue(node, DataStore.class);
|
return mapper.treeToValue(node, DataStore.class);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (Throwable e) {
|
||||||
ErrorEvent.fromThrowable(e).handle();
|
ErrorEvent.fromThrowable(e).handle();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package io.xpipe.beacon;
|
||||||
import io.xpipe.beacon.exchange.StopExchange;
|
import io.xpipe.beacon.exchange.StopExchange;
|
||||||
import io.xpipe.core.impl.FileNames;
|
import io.xpipe.core.impl.FileNames;
|
||||||
import io.xpipe.core.process.OsType;
|
import io.xpipe.core.process.OsType;
|
||||||
import io.xpipe.core.process.ShellDialects;
|
|
||||||
import io.xpipe.core.util.XPipeDaemonMode;
|
import io.xpipe.core.util.XPipeDaemonMode;
|
||||||
import io.xpipe.core.util.XPipeInstallation;
|
import io.xpipe.core.util.XPipeInstallation;
|
||||||
|
|
||||||
|
@ -25,14 +24,19 @@ public class BeaconServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<String> toProcessCommand(String toExec) {
|
||||||
|
var command = OsType.getLocal().equals(OsType.WINDOWS) ? List.of("cmd", "/c", toExec) : List.of("sh", "-c", toExec);
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
public static Process tryStartCustom() throws Exception {
|
public static Process tryStartCustom() throws Exception {
|
||||||
var custom = BeaconConfig.getCustomDaemonCommand();
|
var custom = BeaconConfig.getCustomDaemonCommand();
|
||||||
if (custom != null) {
|
if (custom != null) {
|
||||||
var command = ShellDialects.getPlatformDefault()
|
var toExec = custom
|
||||||
.executeCommandListWithShell(custom
|
+ (BeaconConfig.getDaemonArguments() != null
|
||||||
+ (BeaconConfig.getDaemonArguments() != null
|
? " " + BeaconConfig.getDaemonArguments()
|
||||||
? " " + BeaconConfig.getDaemonArguments()
|
: "");
|
||||||
: ""));
|
var command = toProcessCommand(toExec);
|
||||||
Process process = Runtime.getRuntime().exec(command.toArray(String[]::new));
|
Process process = Runtime.getRuntime().exec(command.toArray(String[]::new));
|
||||||
printDaemonOutput(process, command);
|
printDaemonOutput(process, command);
|
||||||
return process;
|
return process;
|
||||||
|
@ -50,7 +54,7 @@ public class BeaconServer {
|
||||||
getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode);
|
getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
var fullCommand = ShellDialects.getPlatformDefault().executeCommandListWithShell(command);
|
var fullCommand = toProcessCommand(command);
|
||||||
Process process = new ProcessBuilder(fullCommand).start();
|
Process process = new ProcessBuilder(fullCommand).start();
|
||||||
printDaemonOutput(process, fullCommand);
|
printDaemonOutput(process, fullCommand);
|
||||||
return process;
|
return process;
|
||||||
|
|
Loading…
Reference in a new issue