fixes occasional issue when reading from pipes

When reading from a pipe such as `stdin`, the amount of bytes read may be smaller than the size of the buffer. In these cases continue as usual and only break if EOF is encountered (indicated by zero read bytes).