mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 15:40:23 +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();
|
var shell = model.getFileSystem().getShell();
|
||||||
if (shell.isEmpty()) {
|
if (shell.isEmpty() || !shell.get().isRunning()) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,9 @@ public final class OpenFileSystemModel {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start shell in case we exited
|
||||||
|
getFileSystem().getShell().orElseThrow().start();
|
||||||
|
|
||||||
// Fix common issues with paths
|
// Fix common issues with paths
|
||||||
var adjustedPath = FileSystemHelper.adjustPath(this, path);
|
var adjustedPath = FileSystemHelper.adjustPath(this, path);
|
||||||
if (!Objects.equals(path, adjustedPath)) {
|
if (!Objects.equals(path, adjustedPath)) {
|
||||||
|
|
|
@ -29,6 +29,8 @@ public interface LeafAction extends BrowserAction {
|
||||||
|
|
||||||
ThreadHelper.runFailableAsync(() -> {
|
ThreadHelper.runFailableAsync(() -> {
|
||||||
BooleanScope.execute(model.getBusy(), () -> {
|
BooleanScope.execute(model.getBusy(), () -> {
|
||||||
|
// Start shell in case we exited
|
||||||
|
model.getFileSystem().getShell().orElseThrow().start();
|
||||||
execute(model, selected);
|
execute(model, selected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -64,6 +66,8 @@ public interface LeafAction extends BrowserAction {
|
||||||
mi.setOnAction(event -> {
|
mi.setOnAction(event -> {
|
||||||
ThreadHelper.runFailableAsync(() -> {
|
ThreadHelper.runFailableAsync(() -> {
|
||||||
BooleanScope.execute(model.getBusy(), () -> {
|
BooleanScope.execute(model.getBusy(), () -> {
|
||||||
|
// Start shell in case we exited
|
||||||
|
model.getFileSystem().getShell().orElseThrow().start();
|
||||||
execute(model, selected);
|
execute(model, selected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ public interface ProcessControl extends AutoCloseable {
|
||||||
|
|
||||||
ProcessControl withExceptionConverter(ExceptionConverter converter);
|
ProcessControl withExceptionConverter(ExceptionConverter converter);
|
||||||
|
|
||||||
void resetData();
|
void resetData(boolean cache);
|
||||||
|
|
||||||
String prepareTerminalOpen(TerminalInitScriptConfig config) throws Exception;
|
String prepareTerminalOpen(TerminalInitScriptConfig config) throws Exception;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public interface ProcessControl extends AutoCloseable {
|
||||||
@Override
|
@Override
|
||||||
void close() throws Exception;
|
void close() throws Exception;
|
||||||
|
|
||||||
void kill() throws Exception;
|
void kill();
|
||||||
|
|
||||||
ProcessControl start() throws Exception;
|
ProcessControl start() throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.function.Function;
|
||||||
|
|
||||||
public interface ShellControl extends ProcessControl {
|
public interface ShellControl extends ProcessControl {
|
||||||
|
|
||||||
|
List<UUID> getExitUuids();
|
||||||
|
|
||||||
Optional<ShellStore> getSourceStore();
|
Optional<ShellStore> getSourceStore();
|
||||||
|
|
||||||
ShellControl withSourceStore(ShellStore store);
|
ShellControl withSourceStore(ShellStore store);
|
||||||
|
|
Loading…
Reference in a new issue