If you are sure that you want to kill them, then you execute the list of processes and check each parent identifier of the process. If the parent id matches the IronPython process id that you started, you will kill it. This will kill all threads associated with this process. Something like this, where processes are the full array of processes, and the parent is the IronPython process that you started:
private static void killProcessAndChildProcesses(Process[] processes, Process parent) { foreach (Process p in processes) { if (p.GetParentProcessId() == parent.Id) { p.Kill(); } } parent.Kill() }
If you are concerned that child IP processes process their own spawning processes, you need to convert them to a recursive solution.
source share