gpt4 book ai didi

c# - 使用 System.Diagnostic Process 时,我会错过进程开始和捕获输出开始之间的一些输出行吗?

转载 作者:太空宇宙 更新时间:2023-11-03 22:19:32 24 4
gpt4 key购买 nike

如果我有这样的代码

proc.Start();
string resultOut;

while ( (!proc.HasExited && (resultOut = stdOut.ReadLine()) != null))
{
// Do some operation based on resultOut
}

从开始处理到捕获/解析开始,我是否容易错过某些行,还是会等待?如果没有,我该怎么办?

最佳答案

如果您通过 ProcessStartInfo.RedirectStandardOutput 重定向进程的输入和/或输出等,流程输出将直接进入您的流。您不会错过任何输入或输出。

关于c# - 使用 System.Diagnostic Process 时,我会错过进程开始和捕获输出开始之间的一些输出行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3688050/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com