From aeb921f1618b3173bf02fbbf1750cb28257bf3ac Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 7 Mar 2024 19:33:17 +0000 Subject: [PATCH] Improve pwsh launch --- .../io/xpipe/app/prefs/ExternalTerminalType.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java index dde5126af..06daea2d9 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java @@ -85,16 +85,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue { protected CommandBuilder toCommand(LaunchConfiguration configuration) { return CommandBuilder.of().add("-ExecutionPolicy", "Bypass").add("-EncodedCommand").add(sc -> { // Fix for https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850 - String script; - if (configuration.getScriptDialect().equals(ShellDialects.CMD)) { - script = ScriptHelper.createLocalExecScript( - "set \"PSModulePath=\"\r\n" + configuration.getDialectLaunchCommand().buildCommandBase(sc)); - } else { - script = ScriptHelper.createLocalExecScript( - "$env:PSModulePath=\"\"\r\n" + configuration.getDialectLaunchCommand().buildCommandBase(sc)); - } - var base64 = Base64.getEncoder().encodeToString(configuration.withScriptFile(script) - .getDialectLaunchCommand().buildCommandBase(sc).getBytes(StandardCharsets.UTF_16LE)); + var c = "$env:PSModulePath=\"\";" + configuration.getDialectLaunchCommand().buildCommandBase(sc); + var base64 = Base64.getEncoder().encodeToString(c.getBytes(StandardCharsets.UTF_16LE)); return "\"" + base64 + "\""; }); }