in reply to Re^4: Long Process Waits Until End to Display Results
in thread Long Process Waits Until End to Display Results

So the lengthy process is buffering when writing to the output file? If so, it sounds like the program you're executing is doing the buffering, and I quote sgifford:

If that's the case, finding an option to cause the program to display output immediately is the easiest solution; the other option is to connect it to a pseudo-tty, with something like Expect.
  • Comment on Re^5: Long Process Waits Until End to Display Results

Replies are listed 'Best First'.
Re^6: Long Process Waits Until End to Display Results
by tilly (Archbishop) on Dec 08, 2004 at 01:24 UTC
    It is possible that he did not properly background the forked-off process, and therefore Apache was waiting for all possible output to come back before sending anything. (Apache needs that to be able to include the size of the response in the return headers that it sends to the browser.)

    The fun with buffering is that there are many processes involved, and if any one of them buffers, you won't get your output.

      It is possible that he did not properly background the forked-off process,

      What should I be doing to make sure the process is properly backgrounded?

      CT

      Charles Thomas
      Madison, WI
        Close all file descriptors. That either means calling close on STDIN, STDOUT and STDERR (or opening them to files) or else launching a new process with all of those redirected.

        You could have found that at this FAQ entry.