We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fd_sync
1 parent 25547c6 commit d242360Copy full SHA for d242360
Sources/SystemExtras/FileOperations.swift
@@ -583,8 +583,11 @@ extension FileDescriptor {
583
584
internal func _sync() -> Result<Void, Errno> {
585
#if os(Windows)
586
- // TODO: Implement by `FlushFileBuffers`?
587
- return .failure(Errno(rawValue: ERROR_NOT_SUPPORTED))
+ let handle = HANDLE(bitPattern: _get_osfhandle(self.rawValue))
+ return nothingOrErrno(retryOnInterrupt: false) {
588
+ let ok = FlushFileBuffers(handle)
589
+ return ok ? 0 : -1
590
+ }
591
#else
592
nothingOrErrno(retryOnInterrupt: false) {
593
#if SYSTEM_PACKAGE_DARWIN
0 commit comments