Rework shell exit listener to close file browser tabs

This commit is contained in:
crschnick 2024-03-12 10:19:29 +00:00
parent 770c9eb309
commit c2ac2481e4
2 changed files with 8 additions and 2 deletions

View file

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

View file

@ -62,7 +62,7 @@ public interface ShellControl extends ProcessControl {
}
default <T extends ShellStoreState> ShellControl withShellStateFail(StatefulDataStore<T> 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<ShellControl> pc);
ShellControl onFail(Consumer<Throwable> t);
ShellControl onKill(Runnable pc);
ShellControl onStartupFail(Consumer<Throwable> t);
ShellControl withExceptionConverter(ExceptionConverter converter);