【发布时间】:2018-12-07 14:37:17
【问题描述】:
我需要来自我在 Python 3.5.2 中使用 Popen 运行的进程的 PID。
有这个:
with open(info['stdout_file'], 'w') as logfile:
prcs = sp.Popen(split,
stdout=logfile,
stderr=logfile,
cwd=info['runfolder'])
streams = prcs.communicate()
out, err = streams
post = {'pid': prcs.pid}
r = requests.post('https://.../receive_status.php', data=post)
只有在进程完成后才会发布进程的 PID。但我需要它在的过程中能够杀死是。有什么办法吗?因为杀了
【问题讨论】:
标签: python-3.x popen pid