kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

Inconsistent close behavior of sinks and sources returned by corresponding FileSystem methods

Open fzhinkin opened this issue 1 year ago • 0 comments
trafficstars

Sinks and sources created for files using FileSystem.sink and FileSystem.source may or may not throw an exception on close failure, depending on the platform.

For instance, on native platforms close(fd) return code is ignored, and nothing will be reported in case of an error. On the contrary, on JVM, File*Stream.close may throw IOException on a failed close operation.

Moreover, none of RawSink.close and RawSource.close mention that IOException could be thrown.

The behavior should be the same across all the targets. If the correct behavior is to throw an exception (which sounds reasonable to me), then RawSink/Source kdoc may need to be updated.

fzhinkin avatar Feb 14 '24 15:02 fzhinkin