Fix flags variable being set

If an exception is raised, this is thrown:

UnboundLocalError: local variable 'flags' referenced before assignment

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Merge pull request #17 from bfirsh/fix-flags-variable-not-being-set

Fix flags variable being set
Special-case SSL sockets when reading/writing

Calling os.read() or os.write() on an SSLSocket's fileno will read/write
directly from/to the raw socket, without going through the TLS protocol.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Special-case SSL sockets when setting blocking

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Catch errors caused by SSL sockets not having data ready

Just because `select()` has returned, doesn't mean the socket has actual
data ready:

https://docs.python.org/2/library/ssl.html#notes-on-non-blocking-sockets

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Merge pull request #19 from aanand/fix-tls

Fix TLS
Revert "also wait on all pumps."

This reverts commit 8be0c14c9db7aeb63f154ad0e37b781dd05127b5.

Conflicts:
	dockerpty/pty.py
Merge pull request #22 from dnephin/revert_select_on_all_pipes

Revert change to wait on all pumps
Version bump -> 0.3.1 (TLS)
Fix flush logic.
Don't include the stdin stream when interactive is False.

Signed-off-by: Daniel Nephin <dnephin@yelp.com>
Merge pull request #23 from dnephin/revert_select_on_all_pipes

Fix flush logic - take 2
Merge pull request #24 from dnephin/jenkins_fix

Jenkins support - don't select stdin when interactive=False
Bump version to 0.3.2
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
Adding tests for slow stream
Merge pull request #25 from delfick/slow_read

Read doesn't always give the total bytes requested