Allow wait_for to wait on non-traditional files
Use os.path.exists to check for file existence, instead of "can we open this file for reading". Fixes #6710
This commit is contained in:
parent
dc3d22cf0d
commit
34bf59ac4c
1 changed files with 17 additions and 14 deletions
|
@ -176,21 +176,24 @@ def main():
|
||||||
end = start + datetime.timedelta(seconds=timeout)
|
end = start + datetime.timedelta(seconds=timeout)
|
||||||
while datetime.datetime.now() < end:
|
while datetime.datetime.now() < end:
|
||||||
if path:
|
if path:
|
||||||
try:
|
if os.path.exists(path):
|
||||||
f = open(path)
|
if search_regex:
|
||||||
try:
|
try:
|
||||||
if search_regex:
|
f = open(path)
|
||||||
if re.search(search_regex, f.read(), re.MULTILINE):
|
try:
|
||||||
break
|
if re.search(search_regex, f.read(), re.MULTILINE):
|
||||||
else:
|
break
|
||||||
time.sleep(1)
|
else:
|
||||||
else:
|
time.sleep(1)
|
||||||
break
|
finally:
|
||||||
finally:
|
f.close()
|
||||||
f.close()
|
except IOError:
|
||||||
except IOError:
|
time.sleep(1)
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
else:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pass
|
|
||||||
elif port:
|
elif port:
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
s.settimeout(connect_timeout)
|
s.settimeout(connect_timeout)
|
||||||
|
|
Loading…
Reference in a new issue