UnityEditor.MonoProcessRunner.Run C# (CSharp) Method

Run() public method

public Run ( Process process ) : bool
process System.Diagnostics.Process
return bool
        public bool Run(Process process)
        {
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError = true;
            Thread thread = new Thread(new ParameterizedThreadStart(this.ReadOutput));
            Thread thread2 = new Thread(new ParameterizedThreadStart(this.ReadErrors));
            process.Start();
            thread.Start(process);
            thread2.Start(process);
            bool flag = process.WaitForExit(0x927c0);
            DateTime now = DateTime.Now;
        Label_0071:
            if (thread.IsAlive || thread2.IsAlive)
            {
                TimeSpan span = (TimeSpan) (DateTime.Now - now);
                if (span.TotalMilliseconds < 5.0)
                {
                    Thread.Sleep(0);
                    goto Label_0071;
                }
            }
            if (thread.IsAlive)
            {
                thread.Abort();
            }
            if (thread2.IsAlive)
            {
                thread2.Abort();
            }
            thread.Join();
            thread2.Join();
            return flag;
        }
    }

Usage Example

 public static void RunMonoProcess(Process process, string name, string resultingFile)
 {
   MonoProcessRunner monoProcessRunner = new MonoProcessRunner();
   bool flag = monoProcessRunner.Run(process);
   if (process.ExitCode != 0 || !File.Exists(resultingFile))
   {
     string message = "Failed " + name + ": " + MonoProcessUtility.ProcessToString(process) + " result file exists: " + (object) File.Exists(resultingFile) + ". Timed out: " + (object) !flag + "\n\n" + "stdout:\n" + (object) monoProcessRunner.Output + "\n" + "stderr:\n" + (object) monoProcessRunner.Error + "\n";
     Console.WriteLine(message);
     throw new UnityException(message);
   }
 }
All Usage Examples Of UnityEditor.MonoProcessRunner::Run