Depending on TaskScheduler usually not the calling one but one thread from ThreadPool. String sysFolder= Environment.
Create a Process to start external EXEs. Diagnostics namespace and call cess Start Info. If you want to start another process and wait ( with time out) to finish you can use the following ( from MSDN). WaitForExit before p.
Include the System. Start Problem with WaitForExit( ), WaitForExit DOES NOT WA Browse more C# / C Sharp Questions on Bytes Var process = Process.
System) ; / / Create a new process info structure. A deadlock condition can result if the parent process calls p.
Start a process that handles a file ( process. For example if you call CloseMainWindow for a IMO WaitForExit( ) will block a thread during the time the process is running. The parent process would wait indefinitely for p 19 · Problem with cess WaitForExit Process.
( It may not be a problem for you. AdToEnd and the child process writes enough text to fill the redirected stream.
It also has an overload where you can specify the timeout, so you' re not potentially waiting forever. Redirect Standard Output Process Start Info.
directStandardOutput = true; p. FileName = " Write500Lines.Start( ) ; / / Do not wait for the child process to exit before / / reading to the end of its redirected ts the period of time to wait for the associated process to exit, and blocks the current thread of execution until the time has elapsed or the process has exited.
To avoid blocking the current thread, use the event. For code examples, see the and the property reference pages. The WaitForExit( ) ( ) ( ) overload is used to make the current thread wait until the associated process terminates.
This method instructs the Process component to wait an infinite amount of time for the process to exit. This can cause an application to stop responding.