fix non-blocking reads on pty's
Closes #88 (closed)
FIONREAD is not reliable to use for querying the number of bytes available in a pipe because it does not work on mac with pseudo tty's.
The linux manpage states:
The FIONREAD operation is not specified in any standard, but is provided on many implementations.
- add tests to make sure the functionality stays working
- fix it