bpo-34785: Enhanced functionality in pty module by JarryShaw · Pull Request #9525 · python/cpython

As in pty.spawn, once started, the parent process will be hanged, even if the child process is already dead (or a zombie), and must wait for a KeyboardInterrupt or else to terminate the whole process.

Thus, I propose to revise _copy function, where the parent process hung, to check if the child process is dead periodically and if so, terminate the whole process then return.

https://bugs.python.org/issue34785