Is there a wait method which would return when the target process and all its sub-processes exited? It seems Process.WaitForExit() would only wait on on target process.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This might help a bit – Windows 2000 introduced the concept of a “job” which is a collection of processes controlled as ONE unit quite like a process group in UNIX/LINUX. So you can kill a process and all its children by launching the process in a job, then telling Windows to kill all processes in the job.
Basically create a new job, then use the job to spawn the child process. All its children will also be created in the new Job. When you time out, just call the job’s kill() method and the entire process tree will be terminated. You might way to check the .NET documentation for more information on this. I used the Perl’s Win32::Job API to achieve what you are trying to do. Check out the following link on MSDN for more info: Job API Description