mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-25 17:07:26 -04:00
Fixes for sh connections [release]
This commit is contained in:
@@ -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