FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix detection of $PSHOME in front of $env:PATH by SteveL-MSFT · Pull Request #11141 · PowerShell/PowerShell · GitHub

Fix detection of $PSHOME in front of $env:PATH - #11141

Merged
Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:pshome-path
Nov 23, 2019
Merged

Fix detection of $PSHOME in front of $env:PATH#11141
Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:pshome-path

Conversation

Steve Lee (SteveL-MSFT) commented Nov 21, 2019
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

Previous code was incorrectly detecting if $PSHOME was in front using .Contains() since a preview would have the path "$PSHOME\preview" in front. Since this affects startup, we don't want to do a bunch of string manipulation with Split() so to cover the most common case we just check if the start of $env:PATH contains $PSHOME with the path separator and if not add to front. Two scenarios that aren't covered:

  • If $PSHOME is somewhere else in $env:PATH it will be duplicated. This is unlikely and will just have a small perf impact searching $env:PATH.
  • If $env:PATH only contains $PSHOME (without the path separator), then it'll also be duplicated, but this is also unlikely with minor impact.

PR Context

PR Checklist

Travis Plunk (TravisEz13) added MustHave CL-Engine Indicates that a PR should be marked as an engine change in the Change Log labels Nov 23, 2019
Travis Plunk (TravisEz13) merged commit a1c2d3c into PowerShell:master Nov 23, 2019
Steve Lee (SteveL-MSFT) deleted the pshome-path branch November 27, 2019 16:12

Copy link
Copy Markdown

🎉v7.0.0-rc.1 has been released which incorporates this pull request.:tada:

Handy links:

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

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log MustHave

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL