我想监视外部进程的性能信息,如下所示:
resultTable = []
p = psutil.Popen(['/usr/local/bin/brew', 'doctor'])
while p.is_running():
try:
resultTable.append(p.memory_percent())
time.sleep(1)
except psutil.AccessDenied:
break
print(resultTable)
有人可以解释为什么我必须break而不是continue一旦我发现AccessDenied异常?我希望continue强制重新评估该while声明。该过程已经完成,因此p.is_running()应该成为False.