CleanCode.IO ExecProcess
Namespace: CleanCode.IO
Assembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
The results of an external process are collected in one or more Lists. You may collect output from STDOUT and STDERR separately (if for example) you want to display STDOUT results but you want to parse STDERR results and take some other action. Alternately, you may collect the STDOUT and STDERR outputs jointly, interleaved so they show up in temporal order.
Each of the three collections (stdout, stderr, joint list) may be turned on or off via a property (CollectStdOut, CollectStdErr, or CollectJointOutput, respectively). When dealing with small amounts of data, it would not be burdensome to have them all enabled, but if you expect large amounts of data you should enable only those that you will specifically need.
Adapted from notes and community content on http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(VS.80).aspx
Since CleanCode 0.9.15.
private List<string> RunCode() { ExecProcess runner = new ExecProcess("xyz.exe", tempfile); runner.CollectJointOutput = true; runner.RunProcess(); return runner.JointOutput; }