changeset 124:19c42a3cd962

Very fast testees no longer break Popen on some UNIX systems on Python 2.6+
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 24 Apr 2011 20:05:20 +0100
parents 90c002c960cb
children 10aa5a0e46bd
files unix.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/unix.py	Sun Apr 24 19:28:40 2011 +0100
+++ b/unix.py	Sun Apr 24 20:05:20 2011 +0100
@@ -51,6 +51,11 @@
 	from fcntl import fcntl, F_SETFD, F_GETFD, F_SETFL, F_GETFL
 	from os import O_NONBLOCK
 	try:
+		from signal import siginterrupt
+	except ImportError:
+		# Sucks.
+		siginterrupt = lambda signalnum, flag: None
+	try:
 		import cPickle as pickle
 	except ImportError:
 		import pickle
@@ -152,12 +157,14 @@
 					break
 				else:
 					raise
+		siginterrupt(SIGCHLD, False)
 		try:
 			case.process = Popen(*args, **kwargs)
 		except OSError:
 			os.close(read)
 			raise testcases.CannotStartTestee(sys.exc_info()[1])
 		finally:
+			siginterrupt(SIGCHLD, True)
 			os.close(write)
 		try:
 			if not catch_escape: