Share via


AwaitExtensions.WaitForExitAsync(Process, CancellationToken) Method

Definition

Returns a task that completes when the process exits and provides the exit code of that process.

public static System.Threading.Tasks.Task<int> WaitForExitAsync (this System.Diagnostics.Process process, System.Threading.CancellationToken cancellationToken = default);
static member WaitForExitAsync : System.Diagnostics.Process * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function WaitForExitAsync (process As Process, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)

Parameters

process
Process

The process to wait for exit.

cancellationToken
CancellationToken

A token whose cancellation will cause the returned Task to complete before the process exits in a faulted state with an OperationCanceledException. This token has no effect on the process itself.

Returns

A task whose result is the ExitCode of the process.

Applies to