summaryrefslogtreecommitdiffstats
path: root/Lib/pty.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-12-22 18:41:42 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-12-22 18:41:42 (GMT)
commitee0e6d16b371a66e1d9ab8103fb51117db37cdbc (patch)
tree566bc24fe583c883252b956a9f6fe10b1602e0eb /Lib/pty.py
parent3fa5e6ee4527219a9351413ac6ba425be8ea5dd8 (diff)
downloadcpython-ee0e6d16b371a66e1d9ab8103fb51117db37cdbc.zip
cpython-ee0e6d16b371a66e1d9ab8103fb51117db37cdbc.tar.gz
cpython-ee0e6d16b371a66e1d9ab8103fb51117db37cdbc.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>) 2.5 backport candidate.
Diffstat (limited to 'Lib/pty.py')
-rw-r--r--Lib/pty.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/pty.py b/Lib/pty.py
index 889113c..d3eb64f 100644
--- a/Lib/pty.py
+++ b/Lib/pty.py
@@ -121,7 +121,9 @@ 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