summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/emerge21
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/emerge b/bin/emerge
index 723e007c9..3a05d0378 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -242,15 +242,18 @@ def emergelog(xterm_titles, mystr, short_msg=None):
portage_util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
mode=0660)
-
- l=portage_locks.lockfile(mylogfile)
- # seek because we may have gotten held up by the lock.
- # if so, we may not be positioned at the end of the file.
- mylogfile.seek(0,2)
- mylogfile.write(str(time.time())[:10]+": "+mystr+"\n")
- mylogfile.flush()
- portage_locks.unlockfile(l)
- mylogfile.close()
+ mylock = None
+ try:
+ mylock = portage_locks.lockfile(mylogfile)
+ # seek because we may have gotten held up by the lock.
+ # if so, we may not be positioned at the end of the file.
+ mylogfile.seek(0, 2)
+ mylogfile.write(str(time.time())[:10]+": "+mystr+"\n")
+ mylogfile.flush()
+ finally:
+ if mylock:
+ portage_locks.unlockfile(mylock)
+ mylogfile.close()
except (IOError,OSError,portage_exception.PortageException), e:
if secpass >= 1:
print >> sys.stderr, "emergelog():",e