ProcessStartInfo hanging on “WaitForExit”? Why?

前端 未结 22 1855
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 02:59

I have the following code:

info = new System.Diagnostics.ProcessStartInfo(\"TheProgram.exe\", String.Join(\" \", args));
info.CreateNoWindow = true;
info.Win         


        
22条回答
  •  一生所求
    2020-11-22 03:17

    This post maybe outdated but i found out the main cause why it usually hang is due to stack overflow for the redirectStandardoutput or if you have redirectStandarderror.

    As the output data or the error data is large, it will cause a hang time as it is still processing for indefinite duration.

    so to resolve this issue:

    p.StartInfo.RedirectStandardoutput = False
    p.StartInfo.RedirectStandarderror = False
    

提交回复
热议问题