title: C# System.Diagnostics.Process: how to exit a process if it takes more than, say, 10 seconds?
body: <p>I tried the following code:</p>
  
  <pre><code>p = StartProcess("some_process.exe");
  DateTime startTime = DateTime.Now;
  p.Start();
  while (!p.HasExited)
  {
      executeTime = (DateTime.Now - startTime).Milliseconds;
  
      if (executeTime &gt; 10000) // 10 seconds
      {
         Console.Write("Test \"" + inputTest + "\" failed: takes more than 10 seconds");
         break;
      }
  }
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>Is it possible to do that?</p>