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
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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