Skip to content

Refactor CommandBase.Execute to ExecuteAsyncΒ #45311

Open
@kasperk81

Description

command implementations which require async operations need to run them synchronously using .GetAwaiter().GetResult() or .Wait()

with ExecuteAsync in CommandBase,

public abstract int Execute();

and MainAsync in Cli.Program

public static int Main(string[] args)

it will work for both async (remove .Wait(), .GetAwaiter().GetResult()) and sync (with Task.CompletedTask or Task.FromResult).

n.b. CommandBase.Execute is difference than Task.Execute or ICommand.Execute, both of which should also provide Async variant in principle but that's a separate discussion

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions