Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly#11057
Merged
daxian-dbw merged 10 commits intoPowerShell:masterfrom Nov 16, 2019
Merged
Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly#11057daxian-dbw merged 10 commits intoPowerShell:masterfrom
pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly#11057daxian-dbw merged 10 commits intoPowerShell:masterfrom
Conversation
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.
PR Summary
Since
$env:PSModulePathis 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 casepowershell.exeandpowershell_ise.exeremoving PowerShell 7 specific paths creating a new environment for the new process.This is a breaking change as previously, if
pwshdetects it is started from PowerShell, it will clear out$env:PSModulePathand 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
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.