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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.