CClash.Tests.CompilerCacheTest.RunSubprocess C# (CSharp) Method

RunSubprocess() public method

public RunSubprocess ( string prog, string argv, StringBuilder stdout, StringBuilder stderr ) : void
prog string
argv string
stdout StringBuilder
stderr StringBuilder
return void
        void RunSubprocess(string prog, string[] argv, StringBuilder stdout, StringBuilder stderr) {
            var p = new Process();
            
            p.StartInfo = new ProcessStartInfo( prog, Compiler.JoinAguments(argv) );
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;

            p.ErrorDataReceived += (o, a) => {
                if (a.Data != null) {
                    stderr.AppendLine(a.Data);
                }
            };

            p.OutputDataReceived += (o, a) => {
                if (a.Data != null) {
                    stdout.AppendLine(a.Data);
                }
            };

            p.Start();
            p.BeginErrorReadLine();
            p.BeginOutputReadLine(); 

            p.WaitForExit();

        }