AwaitExtensions.WaitForExitAsync(Process, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
.