use select and read process output incrementally