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
PoshChan
reviewed
Nov 13, 2019
PoshChan
reviewed
Nov 13, 2019
PoshChan
reviewed
Nov 13, 2019
Member
Author
|
@PowerShell/powershell-committee reviewed this and agree to accept these changes for Preview.6 |
pwshpwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly
rjmholt
reviewed
Nov 14, 2019
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/NativeCommandProcessor.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Security/certificateCommon.psm1
Outdated
Show resolved
Hide resolved
Co-Authored-By: Robert Holt <[email protected]>
daxian-dbw
reviewed
Nov 14, 2019
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
PoshChan
reviewed
Nov 15, 2019
daxian-dbw
reviewed
Nov 15, 2019
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
PoshChan
reviewed
Nov 15, 2019
Member
Author
|
@PoshChan please retry windows |
Collaborator
|
@SteveL-MSFT, successfully started retry of |
daxian-dbw
reviewed
Nov 16, 2019
| } | ||
| } | ||
|
|
||
| return string.Join(Path.PathSeparator, modulePathList.ToArray()); |
Member
There was a problem hiding this comment.
I think the .ToArray() call is not needed.
I will resolve this in the web ui.
daxian-dbw
approved these changes
Nov 16, 2019
Collaborator
|
Why does this close #7082? |
14 tasks
|
🎉 Handy links: |
This was referenced Nov 21, 2019
Collaborator
|
FYI this PR did not fix #9921 |
14 tasks
1480c1
pushed a commit
to m-ab-s/media-autobuild_suite
that referenced
this pull request
Mar 31, 2022
Issue fixed in PowerShell/PowerShell#11057, released in v7.0.0-preview.6, so available from version 7.0.0 Last Powershell version is 5.1 so 6 was already Powershell Core
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.
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.