watch on POLLERR, POLLHUP and POLLNVAL, thus solved the infinite poll and return after stdin closed or pipe broked.