---
title: "exitCode(_:)"
framework: testing
role: symbol
role_heading: Type Method
path: "testing/exittest/condition/exitcode(_:)"
---

# exitCode(_:)

Creates a condition that matches when a process terminates with a given exit code.

## Declaration

```swift
static func exitCode(_ exitCode: CInt) -> ExitTest.Condition
```

## Parameters

- `exitCode`: The exit code reported by the process.

## Mentioned in

Exit testing

## Discussion

Discussion The C programming language defines two standard exit codes, EXIT_SUCCESS and EXIT_FAILURE. Platforms may additionally define their own non-standard exit codes:  |   |   |   |   |   |  On macOS, FreeBSD, OpenBSD, and Windows, the full exit code reported by the process is reported to the parent process. Linux and other POSIX-like systems may only reliably report the low unsigned 8 bits (0–255) of the exit code.

## See Also

### Failing exit conditions

- [failure](testing/exittest/condition/failure.md)
- [signal(_:)](testing/exittest/condition/signal(_:).md)
