Ignore IOErrors while we're still waiting

This commit is contained in:
meejah
2016-09-15 09:52:40 -06:00
committed by Brian Warner
parent a0fc80d544
commit b2628b0826

View File

@ -7,8 +7,12 @@ def await_file_contents(path, contents, timeout=10):
while time.time() - start_time < timeout:
print(" waiting for '{}'".format(path))
if exists(path):
try:
with open(path, 'r') as f:
current = f.read()
except IOError:
print("IOError; trying again")
else:
if current == contents:
return True
print(" file contents still mismatched")