C# 启动Nginx调试发现ErrorDataReceived被回调了两次,这是什么原因?

这是启动代码:

 ps = new Process();
 ps.StartInfo.FileName = exe;
 ps.StartInfo.Arguments = args;
 ps.StartInfo.UseShellExecute = false;
 ps.StartInfo.RedirectStandardOutput = true;
 ps.StartInfo.RedirectStandardError = true;
 ps.StartInfo.WorkingDirectory = workingDir;
 ps.StartInfo.CreateNoWindow = true;
 ps.EnableRaisingEvents = true;
 ps.ErrorDataReceived += Ps_ErrorDataReceived;
 
 ps.Start();

 ps.BeginOutputReadLine();
 ps.BeginErrorReadLine();
 if (wait) {
     ps.WaitForExit();
     ps.Close();
 }
 

Ps_ErrorDataReceived里我打印了e.Data,发现第一次是错误,第二次是个null,
这是什么原因呢?

查看回复