Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Common Parameters should include a CancellationToken #19685

Copy link
Copy link
@rhubarb-geek-nz

Description

@rhubarb-geek-nz
Issue body actions

Summary of the new feature / enhancement

There have been a number of requests to add timeouts to various commands ( why always in seconds ? ) it would be simpler to add CancellationToken support to Common Parameters so that all commands automatically have the capability in a consistent manner.

While superficially a timeout might seem obvious and simple, a CancellationToken is far more useful and allows the client control over when the cancellation is requested, eg not just because of a timeout but because some other condition occurred after the command has been started.

Proposed technical implementation details (optional)

Proof of concept

This demonstrates a cancellation token working with Invoke-Command

Implementation - CommandWithCancellationToken.cs

Unit tests - CommandWithCancellationTokenTests.cs

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.