process.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:monitorstack 作者: openstack 项目源码 文件源码
def get_cmdlines():
    """Retrieve the cmdline of each process running on the system."""
    processes = []

    # Get our current PID as well as the parent so we can exclude them.
    current_pid = os.getpid()
    parent_pid = os.getppid()

    for proc in psutil.process_iter():
        try:
            if proc.pid not in [current_pid, parent_pid]:
                processes.append(' '.join(proc.cmdline()))
        except psutil.NoSuchProcess:
            pass

    return processes
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号