Mercurial > ~astiob > upreckon > hgweb
diff testcases.py @ 108:218b8c28549c
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 | aa0378ea1f93 |
children | 42c8f5c152a5 |
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: @@ -270,7 +275,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():]