From 9c798b119c012ad8cacced0b80f988d24d9d2ae0 Mon Sep 17 00:00:00 2001 From: Junegunn Choi <junegunn.c@gmail.com> Date: Mon, 25 Nov 2013 17:01:24 +0900 Subject: [PATCH] Remove Python 2.4-incompatible 'with' statement --- library/utilities/wait_for | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/utilities/wait_for b/library/utilities/wait_for index 8644673eb50..a175afc415e 100644 --- a/library/utilities/wait_for +++ b/library/utilities/wait_for @@ -157,7 +157,8 @@ def main(): while datetime.datetime.now() < end: if path: try: - with open(path) as f: + f = open(path) + try: if search_regex: if re.search(search_regex, f.read(), re.MULTILINE): break @@ -165,6 +166,8 @@ def main(): time.sleep(1) else: break + finally: + f.close() except IOError: time.sleep(1) pass