mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
[Patch #783050 from Patrick Lynch] The emulation of forkpty() is incorrect;
the master should close the slave fd. Added a test to test_pty.py that reads from the master_fd after doing a pty.fork(); without the fix it hangs forever instead of raising an exception. (<crossing fingers for the buildbots>) Backport from trunk rev. 53146.
This commit is contained in:
parent
d13eeb7fd2
commit
cd7a78e0a4
3 changed files with 20 additions and 0 deletions
|
@ -121,6 +121,8 @@ def fork():
|
|||
# Explicitly open the tty to make it become a controlling tty.
|
||||
tmp_fd = os.open(os.ttyname(STDOUT_FILENO), os.O_RDWR)
|
||||
os.close(tmp_fd)
|
||||
else:
|
||||
os.close(slave_fd)
|
||||
|
||||
# Parent and child process.
|
||||
return pid, master_fd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue