[問題] 有辦法脫離父程序嗎?
import subprocess
from threading import Thread
def tmp():
subprocess.call("python3 monitor.py", shell=True)
return_dict[x]={'status':'success'}
t=Thread(target=tmp,)
t.start()
t.join(1)
print('end')
monitor.py執行成功,他是無限迴圈
end也print出來
但並沒有脫離父程序
main.py與monitor.py的PID都有出來
有甚麼辦法可以執行外部程式之後就不理他,脫離父程序
如果可行會造成defunct嗎?
感謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.75.55.2
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1544515309.A.2E0.html
※ 編輯: phoenixcx (203.75.55.2), 12/11/2018 16:06:40
推
12/11 16:58,
6年前
, 1F
12/11 16:58, 1F
推
12/11 17:01,
6年前
, 2F
12/11 17:01, 2F
→
12/11 17:04,
6年前
, 3F
12/11 17:04, 3F
可以喔
※ 編輯: phoenixcx (203.75.55.2), 12/11/2018 17:14:49
Python 近期熱門文章
PTT數位生活區 即時熱門文章