---
title: closeOnFork
framework: system
role: symbol
role_heading: Type Property
path: system/filedescriptor/pipeoptions/closeonfork
---

# closeOnFork

Indicates that forking a program closes the file.

## Declaration

```swift
static var closeOnFork: FileDescriptor.PipeOptions { get }
```

## Discussion

Discussion Normally, file descriptors remain open across calls to the fork(2) function. If you specify this option, the file descriptor is closed when forking this process into another process. The state of the file descriptor flags can be inspected using F_GETFD, as described in the fcntl(2) man page. The corresponding C constant is O_CLOFORK.
