summaryrefslogtreecommitdiffstats
path: root/Lib/pty.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-01-31 07:48:49 (GMT)
committerGeorg Brandl <georg@python.org>2007-01-31 07:48:49 (GMT)
commitcd7a78e0a4130674b814934a9d77c92d9cbbf9be (patch)
treee75c4cc5db7b482fec1669c81800952c116b3c57 /Lib/pty.py
parentd13eeb7fd272bdf856ea73d83a5d9e17b5a83322 (diff)
downloadcpython-cd7a78e0a4130674b814934a9d77c92d9cbbf9be.zip
cpython-cd7a78e0a4130674b814934a9d77c92d9cbbf9be.tar.gz
cpython-cd7a78e0a4130674b814934a9d77c92d9cbbf9be.tar.bz2
[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.
Diffstat (limited to 'Lib/pty.py')
-rw-r--r--Lib/pty.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pty.py b/Lib/pty.py
index 889113c..9fd4709 100644
--- a/Lib/pty.py
+++ b/Lib/pty.py
@@ -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