Description
Currently, the only method a cmdlet has for stopping pipeline input is to throw an exception. However, doing so loses output that the cmdlet may have written.
In contrast, built in cmdlets have this capability. For example, Select-Object -First is able to cancel processing of subsequent input objects when the number of objects specified by -First is met.
In many cases, the limitation can be addressed by simply placing a Select-Object statement at the end of the pipeline but only if the constraint is a count of objects. In the cases where the constraint is not a simple count of objects, there is no direct method for accomplishing the same result.
This enhancement proposes providing the same capability to external managed and script-based cmdlets.
NOTE: Select-Object cancels pipeline input by throwing the internal exception StopUpstreamCommandsException. A simple solution would be to mark this exception as public or provide a static method that encapsulates it.
Activity
iSazonov commentedon Jan 31, 2018
Dup #3821
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 16, 2023
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.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.