「StandardOutput.ReadLine()」を呼び出そうとすると、アプリケーションがハングします。
コード:
ProcessStartInfo startInfo = new ProcessStartInfo("c:\\windows\\system32\\myTesting.exe");
String s = " ";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
Process p = Process.Start(startInfo);
p.StandardInput.WriteLine("list volume\n");
String f = "";
while (!p.StandardOutput.EndOfStream)
{
s = p.StandardOutput.ReadLine();
}
「デッドロック例外」エラーが発生することがありますが、常に発生するわけではありません。