output of child process may get lost
There is a race condition in redirect. It occurs if between the call to readPipeBlockingMulti and checkProcess, the child process writes some data and terminates. I think, readPipeBlockingMulti should be called a last time after the child process terminates.