title: system() fails when piping stuff in
body: <p>Here's an example code to reproduce my problem:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      char *f = "toto.txt";
      char cmd[64];
  
      sprintf(cmd, "nano %s", f);
      system(cmd);
      return 0;
  }
  </code></pre>
  
  <p>If I do:</p>
  
  <pre><code>./test
  </code></pre>
  
  <p>Everything is fine, but if I do:</p>
  
  <pre><code>echo "blah"|./test
  </code></pre>
  
  <p>Nano fails:</p>
  
  <pre><code>received SIGHUP or SIGTERM
  </code></pre>
  
  <p>Is there a safer way to execute system commands ? 
  I've already tried redirecting stdin.</p>