<.> Start the sub -process in the .NET and capture the standard output
.NET provides a method for creating sub -processes and redirecting to its standard output to capture output.
Class provides methods for generating and operating processes.
Process
Original code and its limitations
The code provided is trying to solve this problem, but encountered some problems. Since the method blocks the thread, the event processing program will not be called.
Improvement method WaitForExit()
OutputDataReceived
This code uses the method to listen to the output data from the child process.
Event processing program can now be called correctly and can access the capture output in the event processing program.The above is the detailed content of How to Capture STDOUT from a Child Process in .NET?. For more information, please follow other related articles on the PHP Chinese website!