closeAfter(_:)
Runs a closure and then closes the file descriptor, even if an error occurs.
Declaration
func closeAfter<R>(_ body: () throws -> R) throws -> RParameters
- body:
The closure to run. If the closure throws an error, this method closes the file descriptor before it rethrows that error.
Return Value
The value returned by the closure.
Discussion
If body throws an error or an error occurs while closing the file descriptor, this method rethrows that error.