I run the process in my C # application, which launches the console application. I redirected standard input and output and was able to read multiple lines through StandardOutput.ReadLine (). I am sure that ProcessStartInfo is configured correctly.
The console application at startup displays several lines (ends with a marker line), and then waits for input. After receiving the input, it again displays several lines (again ends with the line "marker"), etc. My intention is to read the lines from it until I get the string "marker", after which I know to send the corresponding input line.
My problem is that after several iterations the program freezes. Suspending a debugger tends to place a hang in a call to StandardOutput.EndOfStream. This takes place in the following test code:
while (!mProcess.StandardOutput.EndOfStream)
When I test the marker line, I get the same kind of hang if I try to access the StandardOutput.EndOfStream standard after reading the line:
string line = ""; while (!isMarker(line)) { line = mProcess.StandardOutput.ReadLine(); } bool eos = mProcess.StandardOutput.EndOfStream;
What can I do, does this make this property work so horribly?
source share