handle exit event of child process

Posted by Ehsan on Stack Overflow See other posts from Stack Overflow or by Ehsan
Published on 2011-01-14T09:37:56Z Indexed on 2011/01/14 9:53 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

I have a console application and in the Main method. I start a process like the code below, when process exists, the Exist event of the process is fired but it closed my console application too, I just want to start a process and then in exit event of that process start another process.

It is also wired that process output is reflecting in my main console application.


Process newCrawler = new Process();
newCrawler.StartInfo = new ProcessStartInfo();
newCrawler.StartInfo.FileName = configSection.CrawlerPath;
newCrawler.EnableRaisingEvents = true;
newCrawler.Exited += new EventHandler(newCrawler_Exited);

newCrawler.StartInfo.Arguments = "someArg";
newCrawler.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
newCrawler.StartInfo.UseShellExecute = false;
newCrawler.Start();

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET