Fix elevation failures

This commit is contained in:
crschnick 2023-11-30 22:24:23 +00:00
parent a4ba5d9726
commit 9eaafa204a
2 changed files with 8 additions and 5 deletions

View file

@ -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,

View file

@ -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() {