當父進程被殺死時殺死子進程 - Kill child process when parent process is killed

問題:

I'm creating new processes using System.Diagnostics.Process class from my application.我正在使用我的應用程序中的System.Diagnostics.Process類創建新進程。

I want this processes to be killed when/if my application has crashed.我希望在/如果我的應用程序崩潰時終止此進程。 But if I kill my application from Task Manager, child processes are not killed.但是,如果我從任務管理器中終止我的應用程序,則不會終止子進程。

Is there any way to make child processes dependent on parent process?有沒有辦法讓子進程依賴於父進程?


解決方案:

參考一: https://en.stackoom.com/question/E1eP
參考二: https://stackoom.com/question/E1eP
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章