From eecafd3cf9ec07b241862b377db15afc3ff125cf Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 11 Mar 2023 10:01:08 +0000 Subject: [PATCH] Fixes for sh connections [release] --- .../io/xpipe/app/fxcomps/impl/FileStoreChoiceComp.java | 4 ++-- .../main/java/io/xpipe/core/process/CommandControl.java | 4 ++++ .../io/xpipe/core/process/ProcessOutputException.java | 8 ++++++-- version | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/FileStoreChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/FileStoreChoiceComp.java index 4a2bc3cc..53613014 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/FileStoreChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/FileStoreChoiceComp.java @@ -35,10 +35,10 @@ public class FileStoreChoiceComp extends SimpleComp { var fileProperty = new SimpleStringProperty( selected.getValue() != null ? selected.getValue().getPath() : null); fileProperty.addListener((observable, oldValue, newValue) -> { - setSelected(selected.getValue().getFileSystem(), newValue); + setSelected(selected.getValue() != null ? selected.getValue().getFileSystem() : null, newValue); }); selected.addListener((observable, oldValue, newValue) -> { - fileProperty.setValue(newValue.getPath()); + fileProperty.setValue(newValue != null ? newValue.getPath() : null); }); var fileSystemChoiceComp = new FileSystemStoreChoiceComp(selected).grow(false, true).styleClass(Styles.LEFT_PILL); 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 a1aa4161..48c67d54 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandControl.java @@ -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, 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 a5c17b85..0814cc5e 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java +++ b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java @@ -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; } } diff --git a/version b/version index 89235c0b..4e69c2a2 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.5.9 \ No newline at end of file +0.5.10 \ No newline at end of file