in reply to Redirecting stdout/stderr to pipe

alarm is the usual way to set a timeout. Set it when you fork, and reset it if the child exits in time.

Use select to poll for available data on each of your filehandles, adding to a variable to keep track of the amount of output they've produced.


Caution: Contents may have been coded under pressure.