Handle EINTR/EAGAIN in readb()

I don't know if this is actually correct. But it seems like a reasonable thing to do. @ridiculousfish or anyone else with knowledge here, is this something that we should do, or is there a good reason to treat EINTR/EAGAIN as if the terminal closed?