You are still tying up a background thread, defeating the purpose of this being async in the first place. Indigo thanks for that, but if you don't call WaitForExit on linux, it might create zombie processes.
Subscribe to RSS
Now maybe process. Exited do it under the hood, but I am not sure so I would advise to at least call it. Skip to content. Sign in Sign up. Instantly share code, notes, and snippets. Code Revisions 2 Stars 36 Forks Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist.
Learn more about clone URLs. Download ZIP. The right way to run external process in. NET async version. Diagnostics ; using System. Text ; using System. AppendLine e. BeginOutputReadLine ; process.
Your Answer
Task , errorCloseEvent. WhenAny Task.
This comment has been minimized. Sign in to view.
Yaakov Online
Copy link Quote reply. Great, thank you for sharing this! Add a comment. Active Oldest Votes. In fact, you can use Process. Improve this answer.
The right way to run external process in .NET (async version) · GitHub
Elmo 5, 15 15 gold badges 63 63 silver badges bronze badges. Emiswelt Emiswelt 3, 1 1 gold badge 30 30 silver badges 51 51 bronze badges. Now, if I can this to work on remote machine, this is just what needed since I need to kill a whole bunch of processes with the same exe name Thanks! If you'd like to wait for the process to actually be killed, follow up with a p.
Tim Robinson Tim Robinson 50k 9 9 gold badges silver badges bronze badges. I'm not sure how this achieves "killing" the process if it's till running after timeout has passed, though I thought you were going to use taskkill? WaitForExit returns false if the process is still running after the timeout; use this to determine whether to kill it — Tim Robinson Aug 19 '10 at Arrggh, now realized the question is not phrased correctly.
Will edit now, please view again. Thomas Levesque Thomas Levesque k 59 59 gold badges silver badges bronze badges.

Sign up or log in Sign up using Google. Sign up using Facebook.
- binary options iq option;
- C# (CSharp) System.Diagnostics Process.WaitForExit Examples!
- Waiting for a Process with Timeout in .NET.
Sign up using Email and Password. Post as a guest Name.
System.Diagnostics.Process.WaitForExit(int)
Email Required, but never shown. The Overflow Blog. Introducing The Key. Featured on Meta.