-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in 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:
![image](https://user-images.githubusercontent.com/5832170/147776286-09b3676d-3df6-4f0c-b2ae-09bf9faf1d2e.png)
In PS7:
![image](https://user-images.githubusercontent.com/5832170/147776324-34a4b77b-0620-48d4-8ebc-eb302da5896e.png)
Other changes are pure refactoring (enclosed raw code in
@()
)How Has This Been Tested?
Run
Invoke-Pester ".\test\Scoop-Core.Tests.ps1"
Before:
![image](https://user-images.githubusercontent.com/5832170/147776634-9b020ae9-ef2a-4e75-8133-663768f56b6d.png)
After:
![image](https://user-images.githubusercontent.com/5832170/147776719-14450fdd-c996-4f5c-88e2-f941fdadd391.png)
Checklist: