Improved error handling upon reading from Pty:

- read(2) returns zero upon end-of-file, which should be translated
  to -1 to match Java's end-of-file semantics. Also, when read(2)
  yields a negative value, we should throw an IOException to meet
  the contract of InputStream#read(). Thanks to ceharris for this
  fix.