View source code
Display the source code in std/process.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.process.waitTimeout

Waits until either the process associated with pid terminates or the elapsed time exceeds the given timeout.

Tuple!(bool,"terminated",int,"status") waitTimeout (
  Pid pid,
  Duration timeout
) @safe;

If the process terminates within the given duration it behaves exactly like wait, except that it returns a tuple (true, exit code).

If the process does not terminate within the given duration it will stop waiting and return (false, 0).

The timeout may not exceed (uint.max - 1).msecs (~ 7 weeks, 17 hours).

This function is Windows-Only.

Returns

An Tuple!(bool, "terminated", int, "status").

Throws

ProcessException on failure or on attempt to wait for detached process.

Example

See the spawnProcess documentation.

See also

wait, for a blocking function without timeout. tryWait, for a non-blocking function without timeout.

Authors

Lars Tandle Kyllingstad, Steven Schveighoffer, Vladimir Panteleev

License

Boost License 1.0.