更新时间:2023-10-20 15:40:10
假定您正在使用Process类来执行和捕获控制台的输出,则可以使用
Assuming you are using Process class to execute and capture output for console, you can use Process.WaitForExit method. It will block the current thread till the process finish the execution. There is another overload that can block the current thread till the process finishes or specified timeout period elapsed.