Implement partial pipe read (like '| head -n x')

We had problem with reading some sample lines (top 3) from HdfsTarget but subprocess continues to read rest of data.
This should solve it.
But someone more knowledgeable must review implementation...