summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-27 20:12:29 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-27 20:12:29 +0000
commit86a164d83b36a283d0837afb383d30f6f2a7caae (patch)
tree19e6feb1323c00bceedf6428b206f4f65e0e5f42
parentfad7810f0eb3aa03a495fa8c470b3f09212213c9 (diff)
downloadportage-86a164d83b36a283d0837afb383d30f6f2a7caae.tar.gz
portage-86a164d83b36a283d0837afb383d30f6f2a7caae.tar.bz2
portage-86a164d83b36a283d0837afb383d30f6f2a7caae.zip
Make _test_pty_eof() fork when writing to the slave_fd, since otherwise
it would block on some platforms such as Darwin. svn path=/main/trunk/; revision=14451
-rw-r--r--pym/portage/__init__.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 05f7b86bd..3bc125b94 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -3768,10 +3768,18 @@ def _test_pty_eof():
termios.tcsetattr(slave_fd, termios.TCSANOW, mode)
# Simulate a subprocess writing some data to the
- # slave end of the pipe, and then exiting.
- slave_file.write(_unicode_encode(test_string,
- encoding='utf_8', errors='strict'))
- slave_file.close()
+ # slave end of the pipe, and then exiting. Do a
+ # real fork here since otherwise slave_file.close()
+ # would block on some platforms such as Darwin.
+ pid = os.fork()
+ if pid == 0:
+ slave_file.write(_unicode_encode(test_string,
+ encoding='utf_8', errors='strict'))
+ slave_file.close()
+ os._exit(os.EX_OK)
+ else:
+ slave_file.close()
+ os.waitpid(pid, 0)
eof = False
data = []