ProcessStartInfo hanging on “WaitForExit”? Why?

前端 未结 22 1892
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  -上瘾入骨i
    2020-11-22 03:23

    Rob answered it and saved me few more hours of trials. Read the output/error buffer before waiting:

    // Read the output stream first and then wait.
    string output = p.StandardOutput.ReadToEnd();
    p.WaitForExit();
    

提交回复
热议问题