mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
Ignore IOErrors while we're still waiting
This commit is contained in:
parent
a0fc80d544
commit
b2628b0826
@ -7,13 +7,17 @@ def await_file_contents(path, contents, timeout=10):
|
|||||||
while time.time() - start_time < timeout:
|
while time.time() - start_time < timeout:
|
||||||
print(" waiting for '{}'".format(path))
|
print(" waiting for '{}'".format(path))
|
||||||
if exists(path):
|
if exists(path):
|
||||||
with open(path, 'r') as f:
|
try:
|
||||||
current = f.read()
|
with open(path, 'r') as f:
|
||||||
if current == contents:
|
current = f.read()
|
||||||
return True
|
except IOError:
|
||||||
print(" file contents still mismatched")
|
print("IOError; trying again")
|
||||||
print(" wanted: {}".format(contents.replace('\n', ' ')))
|
else:
|
||||||
print(" got: {}".format(current.replace('\n', ' ')))
|
if current == contents:
|
||||||
|
return True
|
||||||
|
print(" file contents still mismatched")
|
||||||
|
print(" wanted: {}".format(contents.replace('\n', ' ')))
|
||||||
|
print(" got: {}".format(current.replace('\n', ' ')))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if exists(path):
|
if exists(path):
|
||||||
raise Exception("Contents of '{}' mismatched after {}s".format(path, timeout))
|
raise Exception("Contents of '{}' mismatched after {}s".format(path, timeout))
|
||||||
|
Loading…
Reference in New Issue
Block a user