apple / apple/swift-system

Should `FileDescriptor.closeAfter` provide a `FileDescriptor` to the invoked closure?

Open
#54 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
1.4k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

I've been wanting to write something like

```swift
let foo = try FileDescriptor
.open("my-file", .readOnly)
.closeAfter { fileDescriptor in
/// do stuff with fileDescriptor
}
```

Contributor guide

Open the contributing guide

Research direction

Start at the FileDescriptor.closeAfter API and inspect how it currently invokes its closure. Compare that behavior with the proposed closure receiving a FileDescriptor; done means the requested usage is supported while closeAfter retains its intended close-after behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.