comparison win32.py @ 121:72c02b640dcf

Escape presses simultaneous with the testee exiting no longer cancel on Win32
author Oleg Oshmyan <chortos@inbox.lv>
date Sat, 23 Apr 2011 01:16:57 +0300
parents 08a1d6cc5948
children d6fd880207cb
comparison
equal deleted inserted replaced
120:08a1d6cc5948 121:72c02b640dcf
487 WAIT_OBJECT_0): 487 WAIT_OBJECT_0):
488 raise testcases.WallTimeLimitExceeded 488 raise testcases.WallTimeLimitExceeded
489 else: 489 else:
490 case.process.wait() 490 case.process.wait()
491 else: 491 else:
492 handles = stdin, case.process._handle 492 handles = case.process._handle, stdin
493 if case.maxwalltime: 493 if case.maxwalltime:
494 time_end = clock() + case.maxwalltime 494 time_end = clock() + case.maxwalltime
495 while case.process.poll() is None: 495 while case.process.poll() is None:
496 remaining = time_end - clock() 496 remaining = time_end - clock()
497 if remaining > 0: 497 if remaining > 0:
498 if (WaitForMultipleObjects(handles, False, remaining) == 498 if (WaitForMultipleObjects(handles, False, remaining) ==
499 WAIT_OBJECT_0): 499 WAIT_OBJECT_0 + 1):
500 ir = ReadConsoleInput(stdin) 500 ir = ReadConsoleInput(stdin)
501 if (ir and 501 if (ir and
502 ir.EventType == KEY_EVENT and 502 ir.EventType == KEY_EVENT and
503 ir.Event.KeyEvent.bKeyDown and 503 ir.Event.KeyEvent.bKeyDown and
504 ir.Event.KeyEvent.wVirtualKeyCode == 27): 504 ir.Event.KeyEvent.wVirtualKeyCode == 27):
506 else: 506 else:
507 raise testcases.WallTimeLimitExceeded 507 raise testcases.WallTimeLimitExceeded
508 else: 508 else:
509 while case.process.poll() is None: 509 while case.process.poll() is None:
510 if (WaitForMultipleObjects(handles, False, INFINITE) == 510 if (WaitForMultipleObjects(handles, False, INFINITE) ==
511 WAIT_OBJECT_0): 511 WAIT_OBJECT_0 + 1):
512 ir = ReadConsoleInput(stdin) 512 ir = ReadConsoleInput(stdin)
513 if (ir and 513 if (ir and
514 ir.EventType == KEY_EVENT and 514 ir.EventType == KEY_EVENT and
515 ir.Event.KeyEvent.bKeyDown and 515 ir.Event.KeyEvent.bKeyDown and
516 ir.Event.KeyEvent.wVirtualKeyCode == 27): 516 ir.Event.KeyEvent.wVirtualKeyCode == 27):