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();
}