【发布时间】:2015-05-14 13:14:47
【问题描述】:
我正在尝试重定向游戏服务器进程的输出,但我没有收到大部分输出。
Here's a image of what such a server looks like.
现在,我可以收到黄线,但其他所有内容都没有显示,无论是在控制台中还是在我的末尾。
有什么想法吗?
Process p = new Process();
p.StartInfo.FileName = file;
p.StartInfo.Arguments = arguments;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
p.ErrorDataReceived += new DataReceivedEventHandler(ErrorHandler);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
private void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
...
}
private void ErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
...
}
【问题讨论】: