Skip to content
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(scoop-hold): Use 'foreach' loop to allow 'continue' statement #6078

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

niheaven
Copy link
Member

@niheaven niheaven commented Jul 25, 2024

Description

continue statement shouldn't be used outside of a loop, switch, or trap.

Using continue inside a pipeline, such as a ForEach-Object script block, not only exits the pipeline, it potentially terminates the entire runspace.

Ref: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_continue?view=powershell-7.4#do-not-use-continue-outside-of-a-loop-switch-or-trap

Motivation and Context

How Has This Been Tested?

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

@niheaven niheaven merged commit 49ee8ad into develop Jul 25, 2024
2 checks passed
@niheaven niheaven deleted the fix-hold branch July 25, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant