Replace select() with poll() to catch broken write pipes