mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Rework shell control to be more robust in cases it exits unexpectedly
This commit is contained in:
parent
a6cb7b1a30
commit
faf1b6b4c7
5 changed files with 12 additions and 3 deletions
|
@ -53,7 +53,7 @@ public class FileSystemHelper {
|
|||
}
|
||||
|
||||
var shell = model.getFileSystem().getShell();
|
||||
if (shell.isEmpty()) {
|
||||
if (shell.isEmpty() || !shell.get().isRunning()) {
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,9 @@ public final class OpenFileSystemModel {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
// Start shell in case we exited
|
||||
getFileSystem().getShell().orElseThrow().start();
|
||||
|
||||
// Fix common issues with paths
|
||||
var adjustedPath = FileSystemHelper.adjustPath(this, path);
|
||||
if (!Objects.equals(path, adjustedPath)) {
|
||||
|
|
|
@ -29,6 +29,8 @@ public interface LeafAction extends BrowserAction {
|
|||
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BooleanScope.execute(model.getBusy(), () -> {
|
||||
// Start shell in case we exited
|
||||
model.getFileSystem().getShell().orElseThrow().start();
|
||||
execute(model, selected);
|
||||
});
|
||||
});
|
||||
|
@ -64,6 +66,8 @@ public interface LeafAction extends BrowserAction {
|
|||
mi.setOnAction(event -> {
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BooleanScope.execute(model.getBusy(), () -> {
|
||||
// Start shell in case we exited
|
||||
model.getFileSystem().getShell().orElseThrow().start();
|
||||
execute(model, selected);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ public interface ProcessControl extends AutoCloseable {
|
|||
|
||||
ProcessControl withExceptionConverter(ExceptionConverter converter);
|
||||
|
||||
void resetData();
|
||||
void resetData(boolean cache);
|
||||
|
||||
String prepareTerminalOpen(TerminalInitScriptConfig config) throws Exception;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public interface ProcessControl extends AutoCloseable {
|
|||
@Override
|
||||
void close() throws Exception;
|
||||
|
||||
void kill() throws Exception;
|
||||
void kill();
|
||||
|
||||
ProcessControl start() throws Exception;
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.function.Function;
|
|||
|
||||
public interface ShellControl extends ProcessControl {
|
||||
|
||||
List<UUID> getExitUuids();
|
||||
|
||||
Optional<ShellStore> getSourceStore();
|
||||
|
||||
ShellControl withSourceStore(ShellStore store);
|
||||
|
|
Loading…
Reference in a new issue