mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Improve pwsh launch
This commit is contained in:
parent
9ac9128712
commit
aeb921f161
1 changed files with 2 additions and 10 deletions
|
@ -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 + "\"";
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue