In all of the other cases where we'd break out and call finish(), the
other end is probably already gone:
- pselect() won't really error out in our usage, except for EINTR
- if read() on our side of the pty is EOF, the other side is gone
- read() on our side of the pty shouldn't really fail since we've configured it non-blocking and know that data (or EOF) is available
In this case, the child has no way to know that something has gone awry,
so it's helpful to terminate it abruptly rather than hang forever if
it's waiting on something from us, so signal that we should close the
pty after our input buffer has been completely written out to the
process.
While we're here, fix the EOF on stdin case to enqueue our VEOF instead
of sending it immediately to avoid writing events to the process
out-of-order. In the event that one, e.g., redirects a file to script's
stdin, this would almost certainly mean a loss of some input to the
process as we enqueue the file contents pretty quickly and race to
sending it an EOF before the process can read all of it.
PR: 152132