GeezerVison is showing github.com — Use `-ErrorAction Ignore` instead of `SilentlyContinue` with `Get-Command` in build.psm1 by SteveL-MSFT · Pull Request #8832 · PowerShell/PowerShell
Conversation
PR Summary
Change use of SilentlyContinue with Get-Command to Ignore.
PR Context
We are using Get-Command foo -ErrorAction SilentlyContinue to test if a command exists and handle it accordingly. However, SilentlyContinue still puts the ErrorRecord into $Error which (currently) results in the CommandNotFoundSuggestion to show after the script finishes (if that experimental feature is enabledZ). The correct thing is to use Ignore since we are handling this case and not have the ErrorRecord show up in $Error
PR Checklist
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…using it as equivalent to `Test-Command` and don't
want the error to be put into `$Error`
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Labels
CL-BuildPackaging
Indicates that a PR should be marked as a build or packaging change in the Change Log
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.