(self)
Validate pidfile and make it stale if needed
Validate pidfile and make it stale if needed
Validate pidfile and make it stale if needed
def validate(self):
        """ Validate pidfile and make it stale if needed"""
        if not self.fname:
            return
        try:
            with open(self.fname, "r") as f:
                wpid = int(f.read() or 0)

                if wpid <= 0:
                    return

                try:
                    os.kill(wpid, 0)
                    return wpid
                except OSError, e:
                    if e[0] == errno.ESRCH:
                        return
                    raise
        except IOError, e:
            if e[0] == errno.ENOENT:
                return
            raise
def validate ( self ) : if not self . fname : return try : with open ( self . fname , "r" ) as f : wpid = int ( f . read ( ) or 0 ) if wpid <= 0 : return try : os . kill ( wpid , 0 ) return wpid except OSError , e : if e [ 0 ] == errno . ESRCH : return raise except IOError , e : if e [ 0 ] == errno . ENOENT : return raise