Back to index

python3.2  3.2.2
Functions | Variables
test.win_console_handler Namespace Reference


def _ctrl_handler


tuple HandlerRoutine = WINFUNCTYPE(wintypes.BOOL, wintypes.DWORD)
tuple ctrl_handler = HandlerRoutine(_ctrl_handler)
 SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler
tuple m = mmap.mmap(-1, 1, sys.argv[1])

Detailed Description

Script used to test os.kill on Windows, for issue #1220212

This script is started as a subprocess in test_os and is used to test the
CTRL_C_EVENT and CTRL_BREAK_EVENT signals, which requires a custom handler
to be written into the kill target.

See for a
similar example in C.

Function Documentation

def test.win_console_handler._ctrl_handler (   sig) [private]
Handle a sig event and return 0 to terminate the process

Definition at line 20 of file

00021 def _ctrl_handler(sig):
00022     """Handle a sig event and return 0 to terminate the process"""
00023     if sig == signal.CTRL_C_EVENT:
00024         pass
00025     elif sig == signal.CTRL_BREAK_EVENT:
00026         pass
00027     else:
00028         print("UNKNOWN EVENT")
00029     return 0

Variable Documentation

Definition at line 30 of file

tuple test.win_console_handler.HandlerRoutine = WINFUNCTYPE(wintypes.BOOL, wintypes.DWORD)

Definition at line 18 of file

tuple test.win_console_handler.m = mmap.mmap(-1, 1, sys.argv[1])

Definition at line 44 of file

test.win_console_handler.SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler

Definition at line 33 of file