Fix: Restrict Set-ExecutionPolicy to Windows in PowerShell env activation#1477
Draft
Fix: Restrict Set-ExecutionPolicy to Windows in PowerShell env activation#1477
Conversation
…ixes #1399) Agent-Logs-Url: https://github.com/microsoft/vscode-python-environments/sessions/d5ab0bb9-7aa5-4168-a807-dd9bbb72dace Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unwanted error on env activation for MacOS
Fix: Restrict Set-ExecutionPolicy to Windows in PowerShell env activation
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set-ExecutionPolicywas unconditionally prepended to PowerShell activation commands, causingOperation is not supported on this platform.errors on macOS/Linux where the command is not available.Changes
src/managers/common/utils.ts: ExtractedbuildPwshActivationCommands(ps1Path)helper that only emitsSet-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSignedwhenisWindows()is true. On non-Windows, only& activate.ps1is emitted. Also eliminates duplication between theActivate.ps1/activate.ps1branches.src/test/managers/common/utils.getShellActivationCommands.unit.test.ts: Adds tests asserting non-Windows PowerShell activation produces exactly one command (& activate.ps1) with noSet-ExecutionPolicy.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh issue list --state open --limit 5 --json number,title,labels(http block)If you need me to access, download, or install something from one of these locations, you can either: