mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Make GetWindowsPowerShellModulePath compatible with multiple PS installations (#12280)
Add additional check for each component of PSModulePath (that is set for WinPS process) - if it is has pwsh.exe in the parent directory, then it is considered another PS Core installation and this location is also filtered out.
This commit is contained in:
+4
@@ -646,6 +646,10 @@ Describe "PSModulePath changes interacting with other PowerShell processes" -Tag
|
||||
$errors | Should -Be $null
|
||||
}
|
||||
|
||||
It "Allows Windows PowerShell subprocesses to load WinPS version of `$PSHOME modules" {
|
||||
powershell.exe -Command "Get-ChildItem | Out-Null;(Get-Module Microsoft.PowerShell.Management).Path" | Should -BeLike "*system32*"
|
||||
}
|
||||
|
||||
It "Allows PowerShell subprocesses to call core modules" {
|
||||
$errors = & $pwsh -Command "Get-ChildItem" 2>&1 | Where-Object { $_ -is [System.Management.Automation.ErrorRecord] }
|
||||
$errors | Should -Be $null
|
||||
|
||||
Reference in New Issue
Block a user