reading StandardOutput and StandardError from System.Diagnostics.Process
Do, I have been working on some code that calls some external commands and works out some Timing around them. I mentioned this before, and the first part I worked on was memory and CPU usage.
Well, my next task was to make sure the commands where running correctly, and trying to grab the output. Luckily enough, there is an option when creating your process, under StartInfo called RedirectStandardOutput. There is also RedirectStandardError. Both of these tell the process your starting to redirect the output to the StandardOutput and StandardError streams of the process, which can then be read from by your application.
Check out this post on Joel.Net which has demo code, and more info.
blog comments powered by Disqus