X Tutup
Skip to content

Wait-Process: add -Any and -PassThru parameters#19423

Merged
daxian-dbw merged 20 commits intoPowerShell:masterfrom
dwtaber:wait-process-any
Jul 24, 2023
Merged

Wait-Process: add -Any and -PassThru parameters#19423
daxian-dbw merged 20 commits intoPowerShell:masterfrom
dwtaber:wait-process-any

Conversation

@dwtaber
Copy link
Copy Markdown
Contributor

@dwtaber dwtaber commented Mar 29, 2023

PR Summary

When the -Any parameter is used, Wait-Process returns once one of the specified processes terminates, rather than waiting for all of them.

The -PassThru parameter returns Process objects for all of the specified processes. The original request was for -PassThru to return the terminated processes in particular, but I didn't want to make assumptions about whether a user would be interested in the processes that terminated or the ones that are still running.

Neither of these new parameters depends on the other; they work separately or in combination.

PR Context

Resolves #16972

PR Checklist

…nt/Process.cs


Preserve old error-writing behavior when -Any isn't used.

Co-authored-by: Ilya <darpa@yandex.ru>
Copy link
Copy Markdown
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formally LGTM.

We need WG review before merge.

@iSazonov iSazonov added WG-Cmdlets general cmdlet issues WG-Cmdlets-Management cmdlets in the Microsoft.PowerShell.Management module labels Apr 3, 2023
@ghost ghost added the Review - Needed The PR is being reviewed label Apr 10, 2023
@ghost
Copy link
Copy Markdown

ghost commented Apr 10, 2023

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@daxian-dbw daxian-dbw added the Needs-Triage The issue is new and needs to be triaged by a work group. label May 1, 2023
@doctordns
Copy link
Copy Markdown
Collaborator

I have put this issue on the agenda for the next Cmdlete WG meeting.

@StevenBucher98 StevenBucher98 added the PowerShell-Docs needed The PR was reviewed and a PowerShell Docs update is needed label May 8, 2023
@doctordns
Copy link
Copy Markdown
Collaborator

The WG has reviewed this issue and agree that both parameters would be a useful addition.

@iSazonov
Copy link
Copy Markdown
Collaborator

iSazonov commented Jun 8, 2023

@dwtaber Please add tests.

@ghost ghost removed the Review - Needed The PR is being reviewed label Jun 8, 2023
Copy link
Copy Markdown
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwtaber Please open doc issue in https://github.com/MicrosoftDocs/PowerShell-Docs and add reference in the PR description.

@iSazonov iSazonov assigned daxian-dbw and unassigned anmenaga Jun 10, 2023
…rocess.Tests.ps1


Clarified `It` function conditions

Co-authored-by: Steve Lee <slee@microsoft.com>
@SteveL-MSFT SteveL-MSFT removed the Needs-Triage The issue is new and needs to be triaged by a work group. label Jun 21, 2023
@ghost ghost added the Review - Needed The PR is being reviewed label Jun 30, 2023
@ghost
Copy link
Copy Markdown

ghost commented Jun 30, 2023

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@JamesWTruher JamesWTruher added the WG-Reviewed A Working Group has reviewed this and made a recommendation label Jul 5, 2023
@SteveL-MSFT SteveL-MSFT added the CommunityDay-Small A small PR that the PS team has identified to prioritize to review label Jul 11, 2023
Copy link
Copy Markdown
Collaborator

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide a comment about the tests and WindowStyle

@pull-request-quantifier-deprecated
Copy link
Copy Markdown

This PR has 75 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Small
Size       : +64 -11
Percentile : 30%

Total files changed: 2

Change summary by file extension:
.cs : +22 -11
.ps1 : +42 -0

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daxian-dbw daxian-dbw merged commit 3b9e70c into PowerShell:master Jul 24, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Jul 24, 2023
@daxian-dbw daxian-dbw added Review - Needed The PR is being reviewed CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log and removed Review - Needed The PR is being reviewed labels Jul 24, 2023
@dwtaber dwtaber deleted the wait-process-any branch July 24, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log CommunityDay-Small A small PR that the PS team has identified to prioritize to review PowerShell-Docs needed The PR was reviewed and a PowerShell Docs update is needed Small WG-Cmdlets general cmdlet issues WG-Cmdlets-Management cmdlets in the Microsoft.PowerShell.Management module WG-Reviewed A Working Group has reviewed this and made a recommendation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Wait-Process to wait for *any one* of multiple processes, as an opt-in alternative to waiting for *all* of them

9 participants

X Tutup