oxyoo
asked on
How to kill a spawned process?
Hi,
I'm running an external server using System.Diagnostics.Process , the problem
is that this server spawns another process.
So far I am only able to close/kill the first process but not the spawned one.
Is there some way to track all spawned processes and kill them on demand?
I can not kill it by name alone, since this is a common thread name, which could
mean that I kill some other apps process.
Thanks!
I'm running an external server using System.Diagnostics.Process
is that this server spawns another process.
So far I am only able to close/kill the first process but not the spawned one.
Is there some way to track all spawned processes and kill them on demand?
I can not kill it by name alone, since this is a common thread name, which could
mean that I kill some other apps process.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, an excellent solution!
ASKER
is pretty ugly but so far does the job.
Can anyone find any flaws with it?
What the code does is that iterates through all the processes and
finds the parentId, then compares it with my runningServer process
to see if it is the parent. If yes, it kills it.
Open in new window