From bc057876a1fb92f0dcd1c5bfe1610c348715499d Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:48:29 -0700 Subject: [PATCH] Powershell Execution Policy (#798) Bypasses the Execution Policy for setting the script that adds wsh to the path. --- pkg/shellexec/shellexec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/shellexec/shellexec.go b/pkg/shellexec/shellexec.go index e5d48346..63a65ce1 100644 --- a/pkg/shellexec/shellexec.go +++ b/pkg/shellexec/shellexec.go @@ -166,7 +166,7 @@ func StartRemoteShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts Comm } else if remote.IsPowershell(shellPath) { // powershell is weird about quoted path executables and requires an ampersand first shellPath = "& " + shellPath - shellOpts = append(shellOpts, "-NoExit", "-File", homeDir+fmt.Sprintf("/.waveterm/%s/wavepwsh.ps1", shellutil.PwshIntegrationDir)) + shellOpts = append(shellOpts, "-ExecutionPolicy", "Bypass", "-NoExit", "-File", homeDir+fmt.Sprintf("/.waveterm/%s/wavepwsh.ps1", shellutil.PwshIntegrationDir)) } else { if cmdOpts.Login { shellOpts = append(shellOpts, "-l") @@ -276,7 +276,7 @@ func StartShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts CommandOpt // cant set -l or -i with --rcfile shellOpts = append(shellOpts, "--rcfile", shellutil.GetBashRcFileOverride()) } else if remote.IsPowershell(shellPath) { - shellOpts = append(shellOpts, "-NoExit", "-File", shellutil.GetWavePowershellEnv()) + shellOpts = append(shellOpts, "-ExecutionPolicy", "Bypass", "-NoExit", "-File", shellutil.GetWavePowershellEnv()) } else { if cmdOpts.Login { shellOpts = append(shellOpts, "-l")