Launch improvements

This commit is contained in:
crschnick
2025-02-24 14:25:18 +00:00
parent 8f653880ba
commit d6002fa5fc
3 changed files with 16 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ public class TerminalExternalLaunchExchangeImpl extends TerminalExternalLaunchEx
throw new BeaconClientException("Connection " + DataStorage.get().getStorePath(e).toString() + " is not a shell connection");
}
var r = TerminalLauncherManager.externalExchange(e.ref());
var r = TerminalLauncherManager.externalExchange(e.ref(), msg.getArguments());
return Response.builder().command(r).build();
}

View File

@@ -80,7 +80,9 @@ public class StoreCategoryComp extends SimpleComp {
.apply(struc -> {
struc.get().setAlignment(Pos.CENTER);
struc.get().setFocusTraversable(false);
if (OsType.getLocal() != OsType.LINUX) {
if (OsType.getLocal() == OsType.WINDOWS) {
HBox.setMargin(struc.get(), new Insets(0, 0, 2.0, 0));
} else if (OsType.getLocal() == OsType.MACOS) {
HBox.setMargin(struc.get(), new Insets(0, 0, 2.6, 0));
}
})

View File

@@ -8,9 +8,7 @@ import io.xpipe.app.util.SecretManager;
import io.xpipe.app.util.SecretQueryProgress;
import io.xpipe.beacon.BeaconClientException;
import io.xpipe.beacon.BeaconServerException;
import io.xpipe.core.process.ProcessControl;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.TerminalInitScriptConfig;
import io.xpipe.core.process.*;
import java.nio.file.Path;
import java.util.*;
@@ -130,7 +128,7 @@ public class TerminalLauncherManager {
}
public static List<String> externalExchange(DataStoreEntryRef<ShellStore> ref) throws BeaconClientException, BeaconServerException {
public static List<String> externalExchange(DataStoreEntryRef<ShellStore> ref, List<String> arguments) throws BeaconClientException, BeaconServerException {
var request = UUID.randomUUID();
ShellControl session;
try {
@@ -138,8 +136,16 @@ public class TerminalLauncherManager {
} catch (Exception e) {
throw new BeaconServerException(e);
}
var config = TerminalInitScriptConfig.ofName(ref.get().getName());
submitAsync(request, session, config, null);
ProcessControl control;
if (arguments.size() > 0) {
control = session.command(CommandBuilder.of().addAll(arguments));
} else {
control = session;
}
var config = new TerminalInitScriptConfig(ref.get().getName(), false, TerminalInitFunction.none());
submitAsync(request, control, config, null);
waitExchange(request);
var script = launchExchange(request);
try (var sc = LocalShell.getShell().start()) {