d11wtq/dockerpty — pull request #25 by delfick (2014-11-07 05:43:39+00:00)
Title: Read doesn't always give the total bytes requested

There are two places where the semantics of the docker stream means we
know how many bytes can be read.

In those two cases, there is an assumption that read will return
the amount asked for. Whereas the reality is that less than the
requested amount can be returned.

This means if the stream is slow to produce the right number of bytes,
then there can be discrepancies in what dockerpty thinks is next in the
stream.

So we keep reading until either the stream stops or the amount of data
required has been read