Skip to content

Commit ed756c9

Browse files
committed
Remote sign activate.ps1 script
1 parent bb99263 commit ed756c9

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/managers/common/utils.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)