Skip to content

Async cmdlets #7690

@felixfbecker

Description

@felixfbecker

I've recently tried to write a cmdlet that had to use async APIs. Doing so turned out to be incredibly difficult, and with help I found an AsyncCmdlet class that lets you override processRecordAsync etc. as async functions that get CancellationTokens:
https://github.com/felixfbecker/PSKubectl/blob/master/src/AsyncCmdlet.cs
https://github.com/felixfbecker/PSKubectl/blob/master/src/ThreadAffinitiveSynchronizationContext.cs

Could PowerShell provide this out of the box?

Metadata

Metadata

Assignees

Labels

Issue-Enhancementthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeWG-Enginecore PowerShell engine, interpreter, and runtimeWG-ReviewedA Working Group has reviewed this and made a recommendation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions