【发布时间】:2018-06-12 21:40:12
【问题描述】:
以下代码未能超时。即使我必须关闭它,我也想读取进程的输出。
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = '"' + filepath + '"',
Arguments = execArgs,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
string poutput = proc.StandardOutput.ReadToEnd();
bool bl = proc.WaitForExit(0 * 60 * 1000);
【问题讨论】:
-
查看其他类似问题;你只想异步读取它而不是使用同步的
ReadToEnd