如果我有这样的代码
proc.Start();
string resultOut;
while ( (!proc.HasExited && (resultOut = stdOut.ReadLine()) != null))
{
// Do some operation based on resultOut
}
从开始处理到捕获/解析开始,我是否容易错过某些行,还是会等待?如果没有,我该怎么办?
请您参考如下方法:
如果您通过 ProcessStartInfo.RedirectStandardOutput 重定向进程的输入和/或输出等,流程输出将直接进入您的流。您不会错过任何输入或输出。
