swift-system
swift-system copied to clipboard
[Pitch] Add non-throwing FileDescriptor.currentOffset helper
Provided the file descriptor is still valid, accessing the current offset shouldn't fail.
It took me a bit of hunting around to figure out how to access the current offset in a file. I could see this being too trivial to add a helper for, however, after reading the man page for lseek(2), it seemed like the operation shouldn't be able to fail for valid file descriptors, and so there's value in providing a non-throwing way to achieve this.
Would love to hear your feedback. Thanks!