def pidfile_info()

in dcrpm/pidutil.py [0:0]


def pidfile_info(pidfile):
    # type: (str) -> t.Tuple[int, int]
    """
    Returns tuple of yum.pid pid and file mtime. Raises:
        FileNotFoundError if pidfile doesn't exist
        ValueError if pidfile doesn't look like a pid
        Something else that's bad and means we couldn't read it
    """
    with open(pidfile) as f:
        pid = int(f.read())
    if pid <= 1:
        # Negative PIDs lead to sadness
        # https://rachelbythebay.com/w/2014/08/19/fork/
        logger.error("Rejecting crazy pid value")
        raise ValueError("Invalid pid value")
    mtime = int(os.stat(pidfile).st_mtime)
    return (pid, mtime)