Revision: 2995
Author: pekka.klarck
Date: Thu Apr 15 05:00:14 2010
Log: ensure file is closed
http://code.google.com/p/robotframework/source/detail?r=2995

Modified:
 /trunk/src/robot/libraries/OperatingSystem.py

=======================================
--- /trunk/src/robot/libraries/OperatingSystem.py       Fri Apr  9 00:50:53 2010
+++ /trunk/src/robot/libraries/OperatingSystem.py       Thu Apr 15 05:00:14 2010
@@ -586,8 +586,10 @@
         if not os.path.exists(parent):
             os.makedirs(parent)
         f = open(path, mode+'b')
-        f.write(content.encode(encoding))
-        f.close()
+        try:
+            f.write(content.encode(encoding))
+        finally:
+            f.close()
         return path

     def remove_file(self, path):

Reply via email to