summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/iutil.py b/iutil.py
index 7dbd47841..1f7602d57 100644
--- a/iutil.py
+++ b/iutil.py
@@ -138,20 +138,22 @@ def copyFile(source, to, pw = None):
total = os.path.getsize(source)
win = fn(title, text, total)
- count = os.read(f, 262144)
- total = 0
- while (count):
- os.write(t, count)
- total = total + len(count)
- if pw:
- win.set(total)
- count = os.read(f, 16384)
-
- os.close(f)
- os.close(t)
+ try:
+ count = os.read(f, 262144)
+ total = 0
+ while (count):
+ os.write(t, count)
+
+ total = total + len(count)
+ if pw:
+ win.set(total)
+ count = os.read(f, 16384)
+ finally:
+ os.close(f)
+ os.close(t)
- if pw:
- win.pop()
+ if pw:
+ win.pop()
def memInstalled():
f = open("/proc/meminfo", "r")