mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Unsupported shell fixes
This commit is contained in:
parent
3adef9f87f
commit
6bf21edc68
4 changed files with 18 additions and 21 deletions
|
@ -78,9 +78,13 @@ public class SystemStateComp extends SimpleComp {
|
|||
|
||||
public static ObservableValue<State> shellState(StoreEntryWrapper w) {
|
||||
return BindingsHelper.map(w.getPersistentState(), o -> {
|
||||
if (o instanceof ShellStoreState shellStoreState) {
|
||||
return shellStoreState.getRunning() != null
|
||||
? shellStoreState.getRunning() ? SUCCESS : FAILURE
|
||||
if (o instanceof ShellStoreState s) {
|
||||
if (s.getShellDialect() != null && !s.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return s.getRunning() != null
|
||||
? s.getRunning() ? SUCCESS : FAILURE
|
||||
: OTHER;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,16 @@ public class DataStoreFormatter {
|
|||
|
||||
public static ObservableValue<String> shellInformation(StoreEntryWrapper w) {
|
||||
return BindingsHelper.map(w.getPersistentState(), o -> {
|
||||
if (o instanceof ShellStoreState shellStoreState) {
|
||||
if (!shellStoreState.isInitialized()) {
|
||||
if (o instanceof ShellStoreState s) {
|
||||
if (!s.isInitialized()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return shellStoreState.isRunning() ? shellStoreState.getOsName() : "Connection failed";
|
||||
if (s.getShellDialect() != null && !s.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) {
|
||||
return s.getOsName() != null ? s.getOsName() : s.getShellDialect().getDisplayName();
|
||||
}
|
||||
|
||||
return s.isRunning() ? s.getOsName() : "Connection failed";
|
||||
}
|
||||
|
||||
return "?";
|
||||
|
|
|
@ -23,21 +23,6 @@ public interface ShellDumbMode {
|
|||
shellControl.writeLine("exit");
|
||||
}
|
||||
|
||||
class Adjusted implements ShellDumbMode {
|
||||
|
||||
private final ShellDialect replacementDialect;
|
||||
|
||||
public Adjusted(ShellDialect replacementDialect) {
|
||||
this.replacementDialect = replacementDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandBuilder prepareInlineDumbCommand(
|
||||
ShellControl self, ShellControl parent, ShellOpenFunction function) throws Exception {
|
||||
return function.prepareWithInitCommand(replacementDialect.getLoginOpenCommand(null));
|
||||
}
|
||||
}
|
||||
|
||||
class Unsupported implements ShellDumbMode {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,6 +38,10 @@ public class ConnectionFileSystem implements FileSystem {
|
|||
@Override
|
||||
public FileSystem open() throws Exception {
|
||||
shellControl.start();
|
||||
if (!shellControl.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) {
|
||||
shellControl.close();
|
||||
throw new UnsupportedOperationException("System shell does not support file system interaction");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue