~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: Martin
  • Date: 2011-05-27 01:42:37 UTC
  • mto: (5425.4.19 220464-stale-locks)
  • mto: This revision was merged to the branch mainline in revision 5970.
  • Revision ID: gzlist@googlemail.com-20110527014237-kp0j9qua5m9fkot2
Split pid deadness detection code out into osutils

Show diffs side-by-side

added added

removed removed

Lines of Context:
822
822
            mutter("can't parse pid %r from %r" 
823
823
                % (pid_str, self))
824
824
            return False
825
 
        try:
826
 
            # Special meaning of unix kill: just check if it's there.
827
 
            os.kill(pid, 0)
828
 
        except OSError, e:
829
 
            if e.errno == errno.ESRCH:
830
 
                # On this machine, and really not found: as sure as we can be
831
 
                # that it's dead.
832
 
                return True
833
 
            elif e.errno == errno.EPERM:
834
 
                # exists, though not ours
835
 
                return False
836
 
            else:
837
 
                raise
838
 
        else:
839
 
            # Exists and our process: not dead.
840
 
            return False
 
825
        return osutils._posix_is_local_pid_dead(pid)
841
826
 
842
827
 
843
828
def get_username_for_lock_info():