-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(shim): Fix PS1 shim error when in different drive in PS7 #4614
Conversation
Also enclose shim content with @()
@rashil2000 Could you please check enclosed code? I do this carefully and think they haven't changed 😄 It's only refactoring and makes them look prettier. |
Only one minor thing: Some places use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to bash shim due to #4616
Well, the two different quotes are introduced by PowerShell formatter, I'll change them all to |
Close #4616 Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
It should be done. |
@rashil2000 Could you please add some tests for newly added shims? e.g., |
Sure! But I have never written tests for PowerShell before. Could you point at some examples in the codebase I can look at? |
…staller#4614) Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Description
Fix PS1 shim's content switch, change from
^(.\\[\w]:).*$
to^(\.\\)?\w:.*$
. Also enclose shim content with @() for a clear look.Motivation and Context
PS1 shim went wrong in PowerShell 7 if target is in a different drive other than shim dir. This is introduced by
Resolve-Path -Relative
cmdlet's output.In PS5:
In PS7:
Other changes are pure refactoring (enclosed raw code in
@()
)How Has This Been Tested?
Run
Invoke-Pester ".\test\Scoop-Core.Tests.ps1"
Before:
After:
Checklist: