mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +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;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.NullNode;
|
||||
|
@ -23,8 +22,9 @@ public class DataStorageParser {
|
|||
var mapper = JacksonMapper.newMapper();
|
||||
try {
|
||||
return mapper.treeToValue(node, DataSource.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Throwable e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class DataStorageParser {
|
|||
var mapper = JacksonMapper.newMapper();
|
||||
try {
|
||||
return mapper.treeToValue(node, DataStore.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
} catch (Throwable e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package io.xpipe.beacon;
|
|||
import io.xpipe.beacon.exchange.StopExchange;
|
||||
import io.xpipe.core.impl.FileNames;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
import io.xpipe.core.util.XPipeDaemonMode;
|
||||
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 {
|
||||
var custom = BeaconConfig.getCustomDaemonCommand();
|
||||
if (custom != null) {
|
||||
var command = ShellDialects.getPlatformDefault()
|
||||
.executeCommandListWithShell(custom
|
||||
+ (BeaconConfig.getDaemonArguments() != null
|
||||
? " " + BeaconConfig.getDaemonArguments()
|
||||
: ""));
|
||||
var toExec = custom
|
||||
+ (BeaconConfig.getDaemonArguments() != null
|
||||
? " " + BeaconConfig.getDaemonArguments()
|
||||
: "");
|
||||
var command = toProcessCommand(toExec);
|
||||
Process process = Runtime.getRuntime().exec(command.toArray(String[]::new));
|
||||
printDaemonOutput(process, command);
|
||||
return process;
|
||||
|
@ -50,7 +54,7 @@ public class BeaconServer {
|
|||
getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode);
|
||||
}
|
||||
|
||||
var fullCommand = ShellDialects.getPlatformDefault().executeCommandListWithShell(command);
|
||||
var fullCommand = toProcessCommand(command);
|
||||
Process process = new ProcessBuilder(fullCommand).start();
|
||||
printDaemonOutput(process, fullCommand);
|
||||
return process;
|
||||
|
|
Loading…
Reference in a new issue