eden: fix os.fdatasync crash on macos

Summary: Switch to `fsync` instead as heavier weight alternative

Reviewed By: chadaustin

Differential Revision: D17094899

fbshipit-source-id: 7b43eee18dbe793be53bd5d4d29885d2993fe235
This commit is contained in:
Wez Furlong 2019-08-28 11:41:52 -07:00 committed by Facebook Github Bot
parent 45ac09554f
commit b48f2a8a20

View File

@ -436,7 +436,10 @@ class Overlay:
)
try:
os.write(fd, contents)
os.fdatasync(fd)
if getattr(os, "fdatasync", None):
os.fdatasync(fd)
else:
os.fsync(fd)
os.fchmod(fd, 0o644)
os.rename(tmp_path, file_path)
except Exception: