I'd love to know what the fuck is up with it. This has bit me a few times in the past, and is biting me now. Terminal emulator. Should be simple. AFAICT stdout is buffered, and those buffers not filling blocks output from the shell. But they're never going to fill, because interactive shells don't send newlines after all data....
int fd;
if( 0 != forkpty(&fd,0,0,0) ) return;
execvp(getenv("SHELL"), NULL);
No amount of fflush(NULL); or setvbuf(stdout,NULL,_IOLBF, 0); sprinkled on the top or bottom pid makes any difference, if the shell outputs a page or so of text I'll get however much fills the buffer, and then nothing while it waits for the never to be coming output to fill a buffer.
Doesn't seem to affect other terminal apps, but there's scores of folks online bitching about this in every language imaginable.