Fix commands getting stuck on start failure

This commit is contained in:
crschnick 2023-11-29 22:15:40 +00:00
parent 700f539dfb
commit 67b2a7957f
3 changed files with 3 additions and 18 deletions

View file

@ -1,15 +0,0 @@
package io.xpipe.core.process;
import java.io.BufferedInputStream;
import java.io.InputStream;
public class BufferedProcessInputStream extends BufferedInputStream {
public BufferedProcessInputStream(InputStream in, int size) {
super(in, size);
}
public int bufferedAvailable() {
return count - pos;
}
}

View file

@ -93,7 +93,7 @@ public interface CommandControl extends ProcessControl {
discardOrThrow();
return true;
} catch (ProcessOutputException ex) {
if (ex.isTimeOut()) {
if (ex.isIrregularExit()) {
throw ex;
}

View file

@ -44,8 +44,8 @@ public class ProcessOutputException extends Exception {
this.output = output;
}
public boolean isTimeOut() {
return exitCode == CommandControl.EXIT_TIMEOUT_EXIT_CODE;
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;
}
public boolean isKill() {