made pipe_fd[] global variable so it can also be accessed from signal handler (which doesn't take arguments)