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