这是启动代码:
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,
这是什么原因呢?
应该是输出了一个终结标志吧。