Chris Friesen wrote:
On 09/22/2015 05:48 PM, Joshua Harlow wrote:
A present:

>>> import contextlib
>>> import os
>>>
>>> @contextlib.contextmanager
... def synced_file(path, mode='wb'):
... with open(path, mode) as fh:
... yield fh
... os.fdatasync(fh.fileno())
...
>>> with synced_file("/tmp/b.txt") as fh:
... fh.write("b")

Isn't that missing an "fh.flush()" somewhere before the fdatasync()?

I was testing you, obviously, lol, congrats you passed ;)


Chris




__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to