public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r14451 - main/trunk/pym/portage
@ 2009-09-27 20:12 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-09-27 20:12 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-09-27 20:12:29 +0000 (Sun, 27 Sep 2009)
New Revision: 14451

Modified:
   main/trunk/pym/portage/__init__.py
Log:
Make _test_pty_eof() fork when writing to the slave_fd, since otherwise
it would block on some platforms such as Darwin.


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2009-09-27 19:47:13 UTC (rev 14450)
+++ main/trunk/pym/portage/__init__.py	2009-09-27 20:12:29 UTC (rev 14451)
@@ -3768,10 +3768,18 @@
 	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 = []




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-27 20:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-27 20:12 [gentoo-commits] portage r14451 - main/trunk/pym/portage Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox