Various fixes

This commit is contained in:
crschnick
2023-04-23 11:04:39 +00:00
parent b211e10184
commit 56dcf905ef
11 changed files with 98 additions and 25 deletions

View File

@@ -11,10 +11,14 @@ public class ProcessOutputException extends Exception {
return new ProcessOutputException(message, ex.getExitCode(), ex.getOutput());
}
public static ProcessOutputException of(int exitCode, String output) {
var messageSuffix = output != null && !output.isBlank()?": " + output : "";
var message = exitCode == CommandControl.TIMEOUT_EXIT_CODE ? "Process timed out" + messageSuffix : "Process returned with exit code " + exitCode + messageSuffix;
return new ProcessOutputException(message, exitCode, output);
public static ProcessOutputException of(int exitCode, String output, String accumulatedError) {
var combinedError = (accumulatedError != null ? accumulatedError.trim() + "\n" : "") + (output != null ? output.trim() : "");
var message = switch (exitCode) {
case CommandControl.KILLED_EXIT_CODE -> "Process timed out" + combinedError;
case CommandControl.TIMEOUT_EXIT_CODE -> "Process timed out" + combinedError;
default -> "Process returned with exit code " + combinedError;
};
return new ProcessOutputException(message, exitCode, combinedError);
}
private final int exitCode;

View File

@@ -0,0 +1,13 @@
package io.xpipe.core.store;
import io.xpipe.core.process.ShellControl;
public interface DelegateShellStore extends ShellStore {
@Override
default ShellControl createControl() {
return getDelegateHost().create();
}
ShellStore getDelegateHost();
}

View File

@@ -0,0 +1,8 @@
package io.xpipe.core.store;
import java.util.Map;
public interface FixedHierarchyStore extends DataStore {
Map<String, DataStore> listChildren() throws Exception;
}

View File

@@ -0,0 +1,5 @@
package io.xpipe.core.store;
public interface LeafStore extends DataStore {
}