Control the behaviour of spawned process

I want to start a new process and wait for it to finish processing and quit before I continue from the main process. Any advice on how to achieve this?

sepknowAsked:
Who is Participating?
 
Deepu AbrahamR & D Engineering ManagerCommented:
Process.WaitForExit () is the function you need to look for ( without wait time)

Best Regards,
DeepuAbrahamK
0
 
REA_ANDREWCommented:
you have the event exited.

so

            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.Exited += new EventHandler(p_Exited);

    void p_Exited(object sender, EventArgs e)
    {
        throw new Exception("The method or operation is not implemented.");
    }

You could simply put in a waithandle and signal it once that event fires.  You can also check the exit code.

Andrew
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.