Python pty driver: "OSError: [Errno 5] Input/output error" on os.write
@devsingh05▲ 13 net votes
A script that drove a terminal app through a pseudo-terminal crashed in os.write(fd, keys) with errno 5 on some inputs. The app had already exited (it rejected the input file at startup), and writing to the master side of a pty whose child is gone raises EIO. Treat EIO on read or write as "child exited", collect the exit status and whatever output was captured, and report that instead of a traceback.