diff --git a/core/src/main/java/io/xpipe/core/process/CommandControl.java b/core/src/main/java/io/xpipe/core/process/CommandControl.java index 611b3931f..7324ad831 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandControl.java @@ -13,10 +13,12 @@ import java.util.function.Function; public interface CommandControl extends ProcessControl { // Keep these out of a normal exit code range - int UNASSIGNED_EXIT_CODE = -80001; - int EXIT_TIMEOUT_EXIT_CODE = -80002; - int START_FAILED_EXIT_CODE = -80003; - int INTERNAL_ERROR_EXIT_CODE = -80004; + // They have to be in range of 0 - 255 in order to work on all systems + int UNASSIGNED_EXIT_CODE = 160; + int EXIT_TIMEOUT_EXIT_CODE = 161; + int START_FAILED_EXIT_CODE = 162; + int INTERNAL_ERROR_EXIT_CODE = 163; + int ELEVATION_FAILED_EXIT_CODE = 164; enum TerminalExitMode { KEEP_OPEN, diff --git a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java index cb2cfb9f7..6632c04de 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java +++ b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java @@ -30,6 +30,7 @@ public class ProcessOutputException extends Exception { case CommandControl.EXIT_TIMEOUT_EXIT_CODE -> "Wait for process exit timed out" + errorSuffix; case CommandControl.UNASSIGNED_EXIT_CODE -> "Process exited with unknown state. Did an external process interfere?" + errorSuffix; case CommandControl.INTERNAL_ERROR_EXIT_CODE -> "Process execution failed" + errorSuffix; + case CommandControl.ELEVATION_FAILED_EXIT_CODE -> "Process elevation failed" + errorSuffix; default -> "Process returned exit code " + exitCode + errorSuffix; }; return new ProcessOutputException(message, exitCode, combinedError); @@ -45,7 +46,7 @@ public class ProcessOutputException extends Exception { } public boolean isIrregularExit() { - return exitCode == CommandControl.EXIT_TIMEOUT_EXIT_CODE || exitCode == CommandControl.START_FAILED_EXIT_CODE || exitCode == CommandControl.UNASSIGNED_EXIT_CODE || exitCode == CommandControl.INTERNAL_ERROR_EXIT_CODE; + return exitCode == CommandControl.EXIT_TIMEOUT_EXIT_CODE || exitCode == CommandControl.START_FAILED_EXIT_CODE || exitCode == CommandControl.UNASSIGNED_EXIT_CODE || exitCode == CommandControl.INTERNAL_ERROR_EXIT_CODE || exitCode == CommandControl.ELEVATION_FAILED_EXIT_CODE; } public boolean isKill() {