mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-07 07:31:29 +00:00
Fixes for sh connections [release]
This commit is contained in:
1 parent
a752b0c79a
commit
eecafd3cf9
4 files changed
+13
-5
No files matched your search
@@ -11,6 +11,10 @@ import java.util.function.Consumer;
|
||||
|
||||
public interface CommandControl extends ProcessControl {
|
||||
|
||||
public static final int UNASSIGNED_EXIT_CODE = -1;
|
||||
public static final int TIMEOUT_EXIT_CODE = -2;
|
||||
public static final int KILLED_EXIT_CODE = -3;
|
||||
|
||||
static enum TerminalExitMode {
|
||||
KEEP_OPEN,
|
||||
KEEP_OPEN_ON_FAILURE,
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ProcessOutputException extends Exception {
|
||||
|
||||
public static ProcessOutputException of(int exitCode, String output) {
|
||||
var messageSuffix = output != null && !output.isBlank()?": " + output : "";
|
||||
var message = exitCode == -1 ? "Process timed out" + messageSuffix : "Process returned with exit code " + exitCode + messageSuffix;
|
||||
var message = exitCode == CommandControl.TIMEOUT_EXIT_CODE ? "Process timed out" + messageSuffix : "Process returned with exit code " + exitCode + messageSuffix;
|
||||
return new ProcessOutputException(message, exitCode, output);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ public class ProcessOutputException extends Exception {
|
||||
}
|
||||
|
||||
public boolean isTimeOut() {
|
||||
return exitCode == -1;
|
||||
return exitCode == CommandControl.TIMEOUT_EXIT_CODE;
|
||||
}
|
||||
|
||||
public boolean isKill() {
|
||||
return exitCode == CommandControl.KILLED_EXIT_CODE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user