private void RunProgram(ProcessStartInfo startInfo) { using (var program = new UnityEditor.Utils.Program(startInfo)) { program.Start(); while (!program.WaitForExit(100)) { } var output = string.Empty; var standardOutput = program.GetStandardOutput(); if (standardOutput.Length > 0) { output = standardOutput.Aggregate((buf, s) => buf + Environment.NewLine + s); } var errorOutput = program.GetErrorOutput(); if (errorOutput.Length > 0) { output += errorOutput.Aggregate((buf, s) => buf + Environment.NewLine + s); } if (program.ExitCode != 0) { UnityEngine.Debug.LogError("Failed running " + startInfo.FileName + " " + startInfo.Arguments + "\n\n" + output); throw new Exception("IL2CPP compile failed."); } } }