I have a call to Process.Start()
which runs a third party exe. I need to process the output files of this executable so I want the call to Process.Start() to be blocking.
Is it possible to change this call to a blocking call?
Process sampleProcess= new Process();
sampleProcess.StartInfo = sampleProcessInfoObject;
sampleProcess.Start();
Process.WaitForExit() is what you are looking for.
Instructs the Process component to wait indefinitely for the associated process to exit.
You would use it like this:
Process sampleProcess= new Process();
sampleProcess.StartInfo = sampleProcessInfoObject;
sampleProcess.Start();
sampleProcess.WaitForExit(); // Will wait indefinitely until the process exits