comparison unix.py @ 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 fcdcd0c95552
comparison
equal deleted inserted replaced
123:90c002c960cb 124:19c42a3cd962
48 from signal import SIGCHLD, SIG_DFL, signal, set_wakeup_fd 48 from signal import SIGCHLD, SIG_DFL, signal, set_wakeup_fd
49 from select import select, error as SelectError 49 from select import select, error as SelectError
50 from errno import EAGAIN, EINTR 50 from errno import EAGAIN, EINTR
51 from fcntl import fcntl, F_SETFD, F_GETFD, F_SETFL, F_GETFL 51 from fcntl import fcntl, F_SETFD, F_GETFD, F_SETFL, F_GETFL
52 from os import O_NONBLOCK 52 from os import O_NONBLOCK
53 try:
54 from signal import siginterrupt
55 except ImportError:
56 # Sucks.
57 siginterrupt = lambda signalnum, flag: None
53 try: 58 try:
54 import cPickle as pickle 59 import cPickle as pickle
55 except ImportError: 60 except ImportError:
56 import pickle 61 import pickle
57 except ImportError: 62 except ImportError:
150 except OSError: 155 except OSError:
151 if sys.exc_info()[1].errno == EAGAIN: 156 if sys.exc_info()[1].errno == EAGAIN:
152 break 157 break
153 else: 158 else:
154 raise 159 raise
160 siginterrupt(SIGCHLD, False)
155 try: 161 try:
156 case.process = Popen(*args, **kwargs) 162 case.process = Popen(*args, **kwargs)
157 except OSError: 163 except OSError:
158 os.close(read) 164 os.close(read)
159 raise testcases.CannotStartTestee(sys.exc_info()[1]) 165 raise testcases.CannotStartTestee(sys.exc_info()[1])
160 finally: 166 finally:
167 siginterrupt(SIGCHLD, True)
161 os.close(write) 168 os.close(write)
162 try: 169 try:
163 if not catch_escape: 170 if not catch_escape:
164 if case.maxwalltime: 171 if case.maxwalltime:
165 try: 172 try: