Valoda

Process.TryWaitForExitStatus(TimeSpan, ProcessExitStatus) Method

Definition

Waits for the process to exit within the specified timeout.

public:
 bool TryWaitForExitStatus(TimeSpan timeout, [Runtime::InteropServices::Out] System::Diagnostics::ProcessExitStatus ^ % exitStatus);
[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public bool TryWaitForExitStatus(TimeSpan timeout, out System.Diagnostics.ProcessExitStatus? exitStatus);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.TryWaitForExitStatus : TimeSpan * ProcessExitStatus -> bool
Public Function TryWaitForExitStatus (timeout As TimeSpan, ByRef exitStatus As ProcessExitStatus) As Boolean

Parameters

timeout
TimeSpan

The maximum time to wait for the process to exit. Use InfiniteTimeSpan to wait indefinitely.

exitStatus
ProcessExitStatus

When this method returns true, contains the exit status of the process; otherwise, null.

Returns

true if the process exited before the timeout; otherwise, false.

Attributes

Exceptions

There is no process associated with this object, or the process handle or exit status is unavailable.

The process object has been disposed.

The process is on a remote computer.

The current platform is not supported, or, on Unix, the process is not a child process.

timeout, truncated to a whole number of milliseconds, is less than -1 or greater than MaxValue.

Remarks

A timeout stops waiting without terminating the process.

On Unix, obtaining the exit status is supported only for child processes.

Applies to