2
我从Python运行一个bash脚本,产生一些长时间运行(在前台)的进程。但是,如果我用python杀死了子进程对象,那么脚本产生的(子)进程就会变成孤儿而不是被杀死。Python子流程kill()让孩子孤儿
process=subprocess.Popen(['/bin/bash','script']) #this runs in background
[....]
process.terminate()
'脚本' 派生 “过程1 |过程2 | ...”
当terminate()
运行过程链
(过程1 |过程2 ...)被孤立和PID1下运行。我想杀死他们