title: Breaking away a process started from C#
body: <p>I have some existing code making use of <code>System.Diagnostics.Process.Start</code> to start a child process.  It also uses <code>ProcessStartInfo.RedirectStandardOutput</code> to capture the output stream of that process.  This much is working fine.</p>
  
  <p>I also need to attach it to a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684161%28v=vs.85%29.aspx" rel="noreferrer">job object</a>.  I have code which does this as well, and it works fine provided that the process is not already attached to a job.</p>
  
  <p>Unfortunately, that isn't always the case, so I need to create the process with the <code>CREATE_BREAKAWAY_FROM_JOB</code> flag.  This is where I'm stuck.</p>
  
  <p>As I see it, there are two possible ways forward from here:</p>
  
  <ol>
  <li>Somehow convince <code>Process.Start</code> to pass that one extra little flag.</li>
  <li>Abandon the <code>Process</code> class, fall back to raw <code>CreateProcess</code>, and (somehow) redo the output redirection.</li>
  </ol>
  
  <p>I'm not really sure how to do either of these, or if there's some middle ground which might also work.  Has anyone else run into this before and have some ideas/code?</p>