Various bug fixes

This commit is contained in:
crschnick 2024-02-18 12:44:06 +00:00
parent 86ab003913
commit 48a2fab34a
4 changed files with 36 additions and 10 deletions

View file

@ -46,12 +46,8 @@ public class TroubleshootCategory extends AppPrefsCategory {
XPipeInstallation.getCurrentInstallationBasePath()
.toString(),
XPipeInstallation.getDaemonDebugScriptPath(OsType.getLocal()));
if (sc.getOsType().equals(OsType.WINDOWS)) {
sc.executeSimpleCommand(
ApplicationHelper.createDetachCommand(sc, "\"" + script + "\""));
} else {
TerminalLauncher.open("XPipe Debug", LocalShell.getShell().command("\"" + script + "\""));
}
var runScript = sc.getShellDialect().runScriptCommand(sc, script);
TerminalLauncher.openDirect("XPipe Debug", sc, runScript);
}
});
e.consume();

View file

@ -6,12 +6,24 @@ import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.prefs.ExternalTerminalType;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.core.process.*;
import io.xpipe.core.process.ProcessControl;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.TerminalInitScriptConfig;
import java.io.IOException;
import java.util.UUID;
public class TerminalLauncher {
public static void openDirect(String title, ShellControl shellControl, String command) throws Exception {
var type = AppPrefs.get().terminalType().getValue();
if (type == null) {
throw ErrorEvent.unreportable(new IllegalStateException(AppI18n.get("noTerminalSet")));
}
var script = ScriptHelper.createLocalExecScript(command);
var config = new ExternalTerminalType.LaunchConfiguration(null, title, title, script, shellControl.getShellDialect());
type.launch(config);
}
public static void open(String title, ProcessControl cc) throws Exception {
open(null, title, null, cc);
}

View file

@ -15,6 +15,11 @@ public interface ParentSystemAccess {
return false;
}
@Override
public boolean supportsExecutableEnvironment() {
return false;
}
@Override
public String translateFromLocalSystemPath(String path) {
throw new UnsupportedOperationException();
@ -29,6 +34,12 @@ public interface ParentSystemAccess {
static ParentSystemAccess identity() {
return new ParentSystemAccess() {
@Override
public boolean supportsExecutableEnvironment() {
return true;
}
@Override
public boolean supportsFileSystemAccess() {
return true;
@ -64,6 +75,11 @@ public interface ParentSystemAccess {
return a1.supportsExecutables() && a2.supportsExecutables();
}
@Override
public boolean supportsExecutableEnvironment() {
return a1.supportsExecutableEnvironment() && a2.supportsExecutableEnvironment();
}
@Override
public String translateFromLocalSystemPath(String path) throws Exception {
return a2.translateFromLocalSystemPath(a1.translateFromLocalSystemPath(path));
@ -84,6 +100,8 @@ public interface ParentSystemAccess {
boolean supportsExecutables();
boolean supportsExecutableEnvironment();
String translateFromLocalSystemPath(String path) throws Exception;
String translateToLocalSystemPath(String path) throws Exception;

View file

@ -9,7 +9,7 @@ public interface ShellDialectAskpass {
String prepareFixedContent(ShellControl sc, String fileName, List<String> s) throws Exception;
String elevateDumbCommand(ShellControl shellControl, CommandConfiguration command, UUID requestId, String message) throws Exception;
String elevateDumbCommand(ShellControl shellControl, CommandConfiguration command, UUID requestId, CountDown countDown, String message) throws Exception;
String elevateTerminalCommandWithPreparedAskpass(ShellControl shellControl, UUID request, String command, String prefix) throws Exception;
String elevateTerminalCommandWithPreparedAskpass(ShellControl shellControl, String command, String prefix) throws Exception;
}