---
title: waitUntilExit()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/process/waituntilexit()
---

# waitUntilExit()

Blocks the process until the receiver is finished.

## Declaration

```swift
func waitUntilExit()
```

## Discussion

Discussion This method first checks to see if the receiver is still running using isRunning. Then it polls the current run loop using NSDefaultRunLoopMode until the task completes. waitUntilExit() does not guarantee that the terminationHandler block has been fully executed before waitUntilExit() returns.

## See Also

### Related Documentation

- [launch()](foundation/process/launch().md)

### Running and stopping

- [run()](foundation/process/run().md)
- [interrupt()](foundation/process/interrupt().md)
- [resume()](foundation/process/resume().md)
- [suspend()](foundation/process/suspend().md)
- [terminate()](foundation/process/terminate().md)
