diff --git a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java index 33e1633fc..081e349ac 100644 --- a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java @@ -394,6 +394,10 @@ public final class OpenFileSystemModel { this.customScriptsStartIndex = fs.getShell().get().getInitCommands().size(); ProcessControlProvider.get().withDefaultScripts(fs.getShell().get()); + + fs.getShell().get().onKill(() -> { + browserModel.closeFileSystemAsync(this); + }); } fs.open(); this.fileSystem = fs; diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index 79ba1974b..a99ec3b64 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -62,7 +62,7 @@ public interface ShellControl extends ProcessControl { } default ShellControl withShellStateFail(StatefulDataStore store) { - return onFail(shellControl -> { + return onStartupFail(shellControl -> { var s = store.getState(); s.setRunning(false); store.setState(s); @@ -71,7 +71,9 @@ public interface ShellControl extends ProcessControl { ShellControl onExit(Consumer pc); - ShellControl onFail(Consumer t); + ShellControl onKill(Runnable pc); + + ShellControl onStartupFail(Consumer t); ShellControl withExceptionConverter(ExceptionConverter converter);