If the program exec'd in the child process does not read or quits reading for some reason (and yet doesn't exit), then the print loop in the parent will block, so you may want to put an
alarm right before the print loop. Or maybe an alarm right before the print with an 'alarm(0)' right afterward (depending on how much time you expect it to take to process the data). (and BTW, I'd say that setting the alarm handler without calling
alarm anywhere is a typo in the docs)