Commit b00b0ffb authored by Jim Fulton's avatar Jim Fulton

Added flush/fsync to the write method to try to avoid

spurious test failures.  I'm not sure this is really necessary.
parent 7f564127
...@@ -26,6 +26,8 @@ import pkg_resources ...@@ -26,6 +26,8 @@ import pkg_resources
import zc.buildout.buildout import zc.buildout.buildout
import zc.buildout.easy_install import zc.buildout.easy_install
fsync = getattr(os, 'fsync', lambda fileno: None)
setuptools_location = pkg_resources.working_set.find( setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location pkg_resources.Requirement.parse('setuptools')).location
...@@ -57,7 +59,12 @@ def rmdir(*path): ...@@ -57,7 +59,12 @@ def rmdir(*path):
shutil.rmtree(os.path.join(*path)) shutil.rmtree(os.path.join(*path))
def write(dir, *args): def write(dir, *args):
open(os.path.join(dir, *(args[:-1])), 'w').write(args[-1]) path = os.path.join(dir, *(args[:-1]))
f = open(path, 'w')
f.write(args[-1])
f.flush()
fsync(f.fileno())
f.close()
def system(command, input=''): def system(command, input=''):
i, o = os.popen4(command) i, o = os.popen4(command)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment