-
Notifications
You must be signed in to change notification settings - Fork 7.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
Add a PipelineStopToken
cancellation token property to PSCmdlet
#17444
Comments
The engine WG discussed this and agrees that it would be useful. An RFC would be required as we could not unanimously agree to the proposal above. |
If it is for binary cmdlets only, the |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically. Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original. |
RFC to hopefully move forward with this request PowerShell/PowerShell-RFC#382. I've also opened a PR showing the PoC of the proposed approach #24620. |
Summary of the new feature / enhancement
A common pattern for binary cmdlets is to create a cancellation token source that is then cancelled in
PSCmdlet.StopProcessing()
.This is a very useful pattern to enable cancelling a method that takes
CancellationToken
without having to poll for completion. Having this available by default would reduce a lot of boilerplate in binary cmdlets. Boilerplate example:This pattern is not possible in PowerShell directly, instead a script must poll a task for completion if it wants to respect pipeline stops. Polling example:
Even then all you can do is honor pipeline stops, you can't request cancellation of the work being done in another thread.
Proposed technical implementation details (optional)
The text was updated successfully, but these errors were encountered: