PowerShell alias calling non-existent command returns 0 exit code#1801
Open
brycegbrazen wants to merge 2 commits into
Open
Conversation
Signed-off-by: brycegbrazen <bryce.gattis@brazenanimation.com> Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
9b7d8ba to
774963e
Compare
Member
|
Rebased to fix conflict |
Signed-off-by: brycegbrazen <bryce.gattis@brazenanimation.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1801 +/- ##
==========================================
- Coverage 59.30% 59.28% -0.02%
==========================================
Files 126 126
Lines 17210 17217 +7
Branches 3015 3017 +2
==========================================
+ Hits 10206 10207 +1
- Misses 6319 6325 +6
Partials 685 685 ☔ View full report in Codecov by Sentry. |
Contributor
Author
|
Had to change some Let me know what you think @JeanChristopheMorinPerso! |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds failing test for #1800.
After digging into this there are three important Powershell automatic variables to take note of.
$LASTEXITCODE$?$ERRORThe first two,
$LASTEXITCODEand$?are used in the code currently.However, after testing the issue in PowerShell directly, it seems that the issue stems from an issue stemming from PowerShell itself.
When using aliases in PowerShell, if the command being called is not found, and error is printed to stderr, but neither the
$LASTEXITCODEor$?variables are filled out correct to represent this.For example, in PowerShell I ran:
Then I ran the following that does the same thing but using aliases:
Interestingly, it seems like the
$ERRORautomatic variable, correctly captures the error message in both cases.Not sure what the implications would be of additionally relying on the presence of an error in the
$ERRORvariable, but seems to be something that is slipping through the cracks right now. Perhaps there's a better fix for this?