[Overview][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'process' (#fcl)

# TPROCESS.WaitOnExit

Wait for the program to stop executing.

## Declaration

Source position: processbody.inc line 120

`public function TPROCESS.WaitOnExit: Boolean; function TPROCESS.WaitOnExit(`
`Timeout: DWord`
`):Boolean;`

## Function result

True means the process was successfully waited on, False indicates some error occurred.

## Arguments

`Timeout` |  | Timeout for wait (in milliseconds)

## Description

WaitOnExit waits for the running program to exit. It returns True if the wait was successful, or False if there was some error waiting for the program to exit.

Note that the return value of this function has changed. The old return value was a DWord with a platform dependent error code. To make things consistent and cross-platform, a boolean return type was used.

The TimeOut argument can be used to specify a timeout in milliseconds. If omitted, the call will wait indefinitely.

## Errors

On error, False is returned. No extended error information is available, as it is highly system dependent.

## See also

TProcess.ExitStatus |  | Exit status of the process.
TProcess.Terminate |  | Terminate a running process
TProcess.Running |  | Determines whether the process is still running.
TProcess.ExitCode |  | Exit code of the process