open a pipe and read data from pipe.