gotosocial/vendor/github.com/tetratelabs/wazero/internal/sysfs/sync_windows.go
kim 1e7b32490d
[experiment] add alternative wasm sqlite3 implementation available via build-tag (#2863)
This allows for building GoToSocial with [SQLite transpiled to WASM](https://github.com/ncruces/go-sqlite3) and accessed through [Wazero](https://wazero.io/).
2024-05-27 17:46:15 +02:00

21 lines
407 B
Go

package sysfs
import (
"os"
"github.com/tetratelabs/wazero/experimental/sys"
)
func fsync(f *os.File) sys.Errno {
errno := sys.UnwrapOSError(f.Sync())
// Coerce error performing stat on a directory to 0, as it won't work
// on Windows.
switch errno {
case sys.EACCES /* Go 1.20 */, sys.EBADF /* Go 1.19 */ :
if st, err := f.Stat(); err == nil && st.IsDir() {
errno = 0
}
}
return errno
}