[jhbuild] lockfile: Don't throw on stale lock files



commit 97b10a007f7ea3db4021306958b50cd05b38d40f
Author: Colin Walters <walters verbum org>
Date:   Tue Nov 29 13:49:15 2011 -0500

    lockfile: Don't throw on stale lock files
    
    If we read a lock file but the process has exited, gracefully handle
    it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=665030

 jhbuild/utils/lockfile.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/utils/lockfile.py b/jhbuild/utils/lockfile.py
index 4224d0d..07703e3 100644
--- a/jhbuild/utils/lockfile.py
+++ b/jhbuild/utils/lockfile.py
@@ -64,7 +64,10 @@ class SymlinkLockFile(LockFile):
     def _existing_process_matches(self, pid, uid):
         if os.uname()[0] != 'Linux':
             return os.path.exists('/proc/%d' % (pid, ))
-        f = open('/proc/%d/status' % (pid, ))
+        try:
+            f = open('/proc/%d/status' % (pid, ))
+        except IOError, e:
+            return False
         for line in f:
             if line.startswith('Uid:'):
                 (real, rest) = line[4:].split(None, 1)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]