The child should probably fflush()
its output, and/or terminate lines properly. Otherwise the I/O buffering can hang on to the data for quite a while.
You can try to set the O_NONBLOCK
flag (using fcntl()
) on the child's output file descriptor before handing over control, but that will require you to change your parent code's accordingly. As pointed out in comments though, this won't help you overcome the buffering done at the C standard library level if the child uses FILE
-based I/O.
unwind
2010-04-26 11:24:20