@@ -172,10 +172,22 @@ export async function getShellActivationCommands(binDir: string): Promise<{
172172 shellDeactivation . set ( ShellConstants . KSH , [ { executable : 'deactivate' } ] ) ;
173173
174174 if ( await fs . pathExists ( path . join ( binDir , 'Activate.ps1' ) ) ) {
175- shellActivation . set ( ShellConstants . PWSH , [ { executable : '&' , args : [ path . join ( binDir , `Activate.ps1` ) ] } ] ) ;
175+ shellActivation . set ( ShellConstants . PWSH , [
176+ {
177+ executable : 'Set-ExecutionPolicy' ,
178+ args : [ '-Scope' , 'Process' , '-ExecutionPolicy' , 'RemoteSigned' ] ,
179+ } ,
180+ { executable : '&' , args : [ path . join ( binDir , `Activate.ps1` ) ] } ,
181+ ] ) ;
176182 shellDeactivation . set ( ShellConstants . PWSH , [ { executable : 'deactivate' } ] ) ;
177183 } else if ( await fs . pathExists ( path . join ( binDir , 'activate.ps1' ) ) ) {
178- shellActivation . set ( ShellConstants . PWSH , [ { executable : '&' , args : [ path . join ( binDir , `activate.ps1` ) ] } ] ) ;
184+ shellActivation . set ( ShellConstants . PWSH , [
185+ {
186+ executable : 'Set-ExecutionPolicy' ,
187+ args : [ '-Scope' , 'Process' , '-ExecutionPolicy' , 'RemoteSigned' ] ,
188+ } ,
189+ { executable : '&' , args : [ path . join ( binDir , `activate.ps1` ) ] } ,
190+ ] ) ;
179191 shellDeactivation . set ( ShellConstants . PWSH , [ { executable : 'deactivate' } ] ) ;
180192 }
181193
0 commit comments