AwaitExtensions.WaitForExitAsync(Process, CancellationToken) 方法

定义

返回一个任务,该任务在进程退出时完成并提供该进程的退出代码。

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)

参数

process
Process

要等待退出的进程。

cancellationToken
CancellationToken

一个标记,其取消操作将导致返回的任务在进程使用出现在错误状态之前完成 OperationCanceledException 。 此标记对自身不起作用 process

返回

Task<Int32>

其结果为 ExitCode 的的任务 process

适用于