Process.WaitForExitStatusAsync(CancellationToken) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
非同步等待程序退出。
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus> WaitForExitStatusAsync(System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.WaitForExitStatusAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus>
Public Function WaitForExitStatusAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of ProcessExitStatus)
參數
- cancellationToken
- CancellationToken
一個可用來取消等待操作的取消令牌。
傳回
一個代表非同步等待操作的任務。 任務結果包含程序的退出狀態。
- 屬性
例外狀況
此物件沒有相關聯的程序,或程序的處理柄或退出狀態不可用。
程序物件已被處置。
這個過程是在遠端電腦上進行的。
目前平台不支援,或者在 Unix 上,這個程序不是子程序。
已取消 cancellationToken。 例外會儲存在回傳的任務中。
備註
當取消標記被取消時,方法停止等待並拋出 OperationCanceledException。 程序並未終止,繼續執行。 若要終止取消程序,請呼叫 WaitForExitOrKillOnCancellationAsyncSafeHandle。
在 Unix 上,僅支援子程序取得退出狀態。