title: C program when segfault stdout redirect not being captured in a text file
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char* argv[]) {
          printf("hello dude\n");
          //cause segfault
          *(int*)0 = 0;
          return 0;
  }
  gcc test.c -o test
  ./test &amp;&gt; out.txt
  Segmentation fault (core dumped)
  ./test &gt; out.txt
  Segmentation fault (core dumped)
  ./test 1&gt; out.txt
  Segmentation fault (core dumped)
  </code></pre>
  
  <p>Open the text file and "hello dude" is never written.  If you comment out the line that causes the segfault then "hello dude" gets written to the file.  Some how the segfault is interrupting stdout.  Is there something that can be on the command line to capture the output? I tried both cygwin bash and linux bash shells.</p>