Skip to content

Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly#11057

Merged
daxian-dbw merged 10 commits intoPowerShell:masterfrom
SteveL-MSFT:psmodulepath
Nov 16, 2019
Merged

Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly#11057
daxian-dbw merged 10 commits intoPowerShell:masterfrom
SteveL-MSFT:psmodulepath

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Nov 13, 2019

PR Summary

Since $env:PSModulePath is shared across all instances of PowerShell, PowerShell 7 needs to ensure it inherits the env var, but put its paths in front. If starting Windows PowerShell, it will special case powershell.exe and powershell_ise.exe removing PowerShell 7 specific paths creating a new environment for the new process.

This is a breaking change as previously, if pwsh detects it is started from PowerShell, it will clear out $env:PSModulePath and create it from scratch. This change will preserve additions from the system or user env vars but not all have the complicated logic in Windows PowerShell. It will always add user module path, shared module path, and $PSHome module path if it's not already there on startup.

PR Context

Fix #9957
Fix #9921
Fix #7082
Fix #6850
Fix #10620

Implement PowerShell/PowerShell-RFC#233

PR Checklist

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking-Change breaking change that may affect users CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision MustHave

Projects

None yet

5 participants