Process 为什么重定向GAWK的StandardOutput总是在fstat之前

Process 为什么重定向GAWK的StandardOutput总是在fstat之前,process,output,io-redirection,Process,Output,Io Redirection,我有以下代码来读取gawk的输出,并将其重排到文本文件中(而不是使用shell execute和): 检查结果之后,始终从以下行开始: fstat

我有以下代码来读取gawk的输出,并将其重排到文本文件中(而不是使用shell execute和
):

检查
结果
之后,始终从以下行开始:

fstat<0:fd=0
fstat<0:fd=2

虽然从shell执行gawk.exe,但这些行不存在


我做错了什么?或者更好,我如何在没有额外解析的情况下摆脱这两行?

这个问题与使用过的gawk.exe版本有关,该版本是。 与此相关的问题不会发生

var processStartInfo = new ProcessStartInfo
                       {
                         FileName = "gawk.exe",
                         Arguments = $@"-F ""{separator}"" -f ""{scriptFullFileName}"" ""{inputFullFileName}""",
                         UseShellExecute = false,
                         WorkingDirectory = workingDirectory,
                         RedirectStandardOutput = true,
                         CreateNoWindow = true
                       };
using (var process = Process.Start(processStartInfo))
{
  using (var streamReader = process.StandardOutput)
  {
    var result = streamReader.ReadToEnd();
  }
}