1
我有以下代碼片段來調入的命令行:Process.Exited事件不被調用
p = new Process();
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe";
psi.Arguments = "/C " + "type " + 「[abc].pdf」;
psi.UseShellExecute = false;
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
p.StartInfo = psi;
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.Start();
p.WaitForExit();
奇怪的是,當[ABC]是一個小的pdf文件(8KB)p_Exited
被調用。但是當它是一個大的pdf文件(120kb)時,它永遠不會被調用。任何線索?
感謝,
是否永遠等待WaitForExit或者它傳遞線而忽略了事件? – Elisha 2009-11-20 07:55:19
似乎永遠等待WaitForExit。兩者之間沒有發生異常。 – user124858 2009-11-20 08:26:23
這是什麼語言?將它包含在標籤中會很有幫助! – 2009-11-20 08:47:33