diff testcases.py @ 112:f0b63838f407 2.00

Fixed a crash due to SIGCHLD interrupting validator output pipe reads
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 08 Apr 2011 19:24:51 +0300
parents 6d6d2c82e776
children
line wrap: on
line diff
--- a/testcases.py	Fri Apr 08 19:22:19 2011 +0300
+++ b/testcases.py	Fri Apr 08 19:24:51 2011 +0300
@@ -29,6 +29,11 @@
 	else:
 		clock = time.time
 
+class DummySignalIgnorer(object):
+	def __enter__(self): pass
+	def __exit__(self, exc_type, exc_value, traceback): pass
+signal_ignorer = DummySignalIgnorer()
+
 try:
 	from win32 import *
 except Exception:
@@ -274,7 +279,8 @@
 				case.process = Popen(case.validator, stdin=devnull, stdout=PIPE, stderr=STDOUT, universal_newlines=True, bufsize=-1)
 			except OSError:
 				raise CannotStartValidator(sys.exc_info()[1])
-			comment = case.process.communicate()[0].strip()
+			with signal_ignorer:
+				comment = case.process.communicate()[0].strip()
 			match = re.match(r'(?i)(ok|(?:correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment)
 			if match:
 				comment = comment[match.end():]