title: sort called via execve from child does not terminate naturally
body: <p>I'm trying to shove some text files through a pipe that has been dup'd over sort's stdin. It works, but it does not terminate naturally(Interestingly,pressing the "enter" button seems to do it).</p>
  
  <pre><code>//child
  if(rc == 0)
  {
      alarm(60);
      close(stdin_pipe_fds[1]);
  
      close(0);
      dup(stdin_pipe_fds[0]);
      close(stdin_pipe_fds[0]);
      execve("/usr/bin/sort", argv, NULL);
      exit(0);
  }
  
  //Parent
  if(rc &gt;0)
  {
      alarm(60);
      close(stdin_pipe_fds[0]);
      close(stdout_pipe_fds[1]);
      close(stderr_pipe_fds[1]);
      while(fscanf(coolFile, "%1023s", newWord) ==1)
      {
          if(strcmp(newWord, "foobar") != 0)
          {
              write(stdin_pipe_fds[1], newWord, (strlen(newWord)+1));
          }
      }
      if(argc == 2)
      {
          write(stdin_pipe, argc[2], 2);
      }
      if(argc == 3)
      {
          write(stdin_pipe, argc[3], 2);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Any ideas?</p>