This has been asked before but I can’t find a definitive answer, in code.
I open a process, ProcessA (with PID 1234). This process opens a child process, ProcessAB (PID 5678).
After I’m done I terminate ProcessA but I still have the lingering of ProcessAB.
How do I terminate the whole process tree? What I mean, how do I make sure that if I terminate the process I opened I am also terminating all the associated processes?
Thanks
Code is appreciated.
Check this thread for grouping processes within a “job”.
If that does not work for you, a home grown approach might go as follows:
Sample code: