MCPcopy Create free account
hub / github.com/python/cpython / test_CTRL_C_EVENT

Method test_CTRL_C_EVENT

Lib/test/test_os/test_windows.py:123–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 @unittest.skip("subprocesses aren't inheriting Ctrl+C property")
122 @support.requires_subprocess()
123 def test_CTRL_C_EVENT(self):
124 from ctypes import wintypes
125 import ctypes
126
127 # Make a NULL value by creating a pointer with no argument.
128 NULL = ctypes.POINTER(ctypes.c_int)()
129 SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler
130 SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int),
131 wintypes.BOOL)
132 SetConsoleCtrlHandler.restype = wintypes.BOOL
133
134 # Calling this with NULL and FALSE causes the calling process to
135 # handle Ctrl+C, rather than ignore it. This property is inherited
136 # by subprocesses.
137 SetConsoleCtrlHandler(NULL, 0)
138
139 self._kill_with_event(signal.CTRL_C_EVENT, "CTRL_C_EVENT")
140
141 @support.requires_subprocess()
142 def test_CTRL_BREAK_EVENT(self):

Callers

nothing calls this directly

Calls 1

_kill_with_eventMethod · 0.95

Tested by

no test coverage detected