I'm running this code snippet:
_taskListProcess = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C tasklist /FO CSV /NH";
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
_taskListProcess.StartInfo = startInfo;
_taskListProcess.EnableRaisingEvents = true;
_taskListProcess.Exited += new EventHandler(HandleTaskListProcessTerminated);
_taskListProcess.Start();
My issue is that the tasklist process never terminate. I see it dangling in the Window task manager. Therefore, my function HandleTaskListProcessTerminated is never called.
I'm developing on Unity which uses Mono.