title: How can I run a command line app in C# and redirect/display its standard output while preserving the colors from the app?
body: <p>I am calling git via a command line in C#:</p>
  
  <pre class="lang-cs prettyprint-override"><code>var logger = CreateProcess("git", $"log -n 1 {branchName}");
  // some more code here
  Console.WriteLine(logger.StandardOutput.ReadToEnd());
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>private static Process CreateProcess(string exe, string args)
  {
      var p = new Process();
      p.StartInfo.FileName = exe;
      p.StartInfo.Arguments = args;
      p.StartInfo.UseShellExecute = false;
      p.StartInfo.RedirectStandardOutput = true;
      return p;
  }
  </code></pre>
  
  <p>However the colors that are normally displayed by the command line git app are not displayed when I later go to write the redirected output ot the console; everything is white instead. Is there any way to run the app and redirect the output without losing the colors?</p>