IAsyncCommandRunAsync Method

Runs the command asynchronously.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 5.0.0+724ca9b7fa5edc075ec2ae65044e61b0d494fd1c
C#
Task<int> RunAsync(
	CancellationToken cancellationToken = default
)

Parameters

cancellationToken  CancellationToken  (Optional)
The token to monitor for cancellation requests. The default value is CancellationTokenNone.

Return Value

TaskInt32
A task that represents the asynchronous run operation. The result of the task is the exit code for the command.

Remarks

Typically, your application's Main() method should return the exit code of the command that was executed.

This method will only be invoked if you run commands with the CommandManagerRunCommandAsync(CancellationToken) method or one of its overloads. Typically, it's recommended to implement the ICommandRun method to invoke this method and wait for it. Use the AsyncCommandBase class for a default implementation that does this.

If a CancellationToken was passed to the CommandManagerRunCommandAsync(CancellationToken) method, the cancellationToken parameter will be set to that token. Otherwise, the value will be CancellationTokenNone.

See Also