Execute Process Chain

后端 未结 2 1209
半阙折子戏
半阙折子戏 2021-01-13 18:48
  public void ExecuteProcessChain(string[] asProcesses, string sInRedirect, string sOutRedirect)
    {
            Process p1 = new Process();
            p1.StartIn         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-13 19:36

    ReadLine is reading from the output of the first calc. Calc doesn't send any output. So, ReadLine will never return and thus the next calc will not start. When the first calc terminates, ReadLine can no longer read from the first calc, so returns null. After it has returned, the code can start the second calc.

    You can either not read from the first calc or read asynchronously. You might want to refer to Async ReadLine on how to read asynchronously.

    You could alternatively start the second calc with p2 before you start calling ReadLine.

提交回复
热议问题