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
评论列表
文章目录