8000 Miscellaneous minor updates to WinCompat by anmenaga · Pull Request #11980 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@anmenaga
Copy link
@anmenaga anmenaga commented Feb 29, 2020

PR Summary

Several small fixes to some WinCompat scenarios:

  1. Removing PS-Core-specific paths from PSModulePath of WinCompat process (Windows PS). Similar change was done previously by Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly #11057 for NativeCommandProcessor. This PR enables same
    PSModulePath behavior for WinCompat process (Windows PS) and job's process (Windows PS - for jobs started with -PSVersion 5.1). Without this change there could be bad cases when WinCompat process was loading PS-Core versions of the modules.

  2. Some implicit WinCompat scenarios were ignoring -NoClobber and -Scope parameters. This is now fixed.

  3. Get-PSSession -Name generates an error when the session is not found (in addition to returning nothing). When WinCompat uses Get-PSSession to search for existing WinPSCompatSession session to reuse, such error is not shown to the user but it is written to the error stream. Considering that it is normal for WinPSCompatSession session to not be there before the first WinCompat module import, such error is expected but it may confuse user if it is found in the error stream. The fix is to do Get-PSSession -Name WinPSCompatSession -ErrorAction Ignore.
    Fix The remote session with the name WinPSCompatSession is not available #11903

  4. Fixed a test bug in ModulePath.Tests.ps1.

PR Checklist

@anmenaga anmenaga added WG-Remoting PSRP issues with any transport layer CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log labels Feb 29, 2020
@anmenaga anmenaga added this to the 7.0.x-Servicing-Consider milestone Feb 29, 2020
@anmenaga anmenaga requested a review from SteveL-MSFT February 29, 2020 00:48
@ghost ghost assigned iSazonov Feb 29, 2020
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Mar 2, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Mar 2, 2020
@codykonior
Copy link
codykonior commented Mar 9, 2020

The Get-PSSession fix is critical for anyone who wants to run PS 7 in critical production environments and so uses $ErrorActionPreference = 'Stop'.

It cannot be overridden manually with -ErrorActionPreference:Continue; the only workaround is to set the variable to Continue and then run it, but then you require extra code to detect and parse if any errors occurred loading the module. Alternately, Import-WinModule can be used instead.

Hope this gets merged in and made available ASAP.

@anmenaga
Copy link
Author
anmenaga commented Mar 9, 2020

@iSazonov looks like this is ready for merge.

@iSazonov iSazonov merged commit 704b0e7 into PowerShell:master Mar 10, 2020
@ghost
Copy link
ghost commented Mar 26, 2020

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link
ghost commented May 14, 2020

🎉v7.0.1 has been released which incorporates this pull request.:tada:

Handy links:

silijon pushed a commit to SkyKick/PowerShell that referenced this pull request Jul 2, 2020
* Filter PSModulePath when starting PS 5.1. Removing PS-Core-specific paths from PSModulePath of WinCompat process (Windows PS).
* Make implicit WinCompat respect NoClobber and Scope parameters
* Add ErrorAction.Ignore when searching for WinPSCompatSession
# Conflicts:
#	src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log WG-Remoting PSRP issues with any transport layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The remote session with the name WinPSCompatSession is not available

6 participants

0