Message129761
Hello!
I see some 'skip' in test_os.py
@unittest.skip("subprocesses aren't inheriting CTRL+C property")
def test_CTRL_C_EVENT(self):
I think, problem with calling SetConsoleCtrlHandler(NULL,0) in parent process, rather in child. If call SetConsoleCtrlHandler(NULL, 0).
Calling SetConsoleCtrlHandler(ctrl_handler, 1) is not enough. Need first call SetConsoleCtrlHandler(NULL, 0).
My patch for this test fixture: (may be, not so good, but it works)
H:\usr\python27\Lib\test>diff win_console_handler.py win_console_handler.py_orig
26,27d25
< elif sig == signal.SIGINT:
< pass
34,35d31
< def ctrl_handler_int(sig, obj):
< sys.exit(1)
40d35
< NULL = ctypes.POINTER(ctypes.c_int)()
43,53d37
< # Calling this with NULL and FALSE causes the calling process to
< # handle CTRL+C, rather than ignore it. This property isn't inherited
< # by subprocesses, if it's created with CREATE_NEW_PROCESS_GROUP flag
< SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int), wintypes.B
OOL)
< if not SetConsoleCtrlHandler(NULL, 0):
< print("Unable to restore SetConsoleCtrlHandler")
< exit(-1)
<
< signal.signal(signal.SIGINT, ctrl_handler_int)
<
< SetConsoleCtrlHandler.argtypes = (HandlerRoutine, wintypes.BOOL)
57a42
>
And on my machine (win2003 32bit):
...
test_CTRL_BREAK_EVENT (__main__.Win32KillTests) ... ok
test_CTRL_C_EVENT (__main__.Win32KillTests) ... ok
test_kill_int (__main__.Win32KillTests) ... ok
test_kill_sigterm (__main__.Win32KillTests) ... ok
----------------------------------------------------------------------
Ran 61 tests in 2.344s
OK |
|
Date |
User |
Action |
Args |
2011-03-01 13:30:21 | iigor | set | recipients:
+ iigor |
2011-03-01 13:30:21 | iigor | set | messageid: <1298986221.06.0.20392871991.issue11361@psf.upfronthosting.co.za> |
2011-03-01 13:30:20 | iigor | link | issue11361 messages |
2011-03-01 13:30:20 | iigor | create | |
|