B
    u9aˆ  ã               @   s¸   d Z ddlmZmZ ddlZddlZddlZddlZeejejƒZ	dd„ Z
e	e
ƒZejjjZe	ejfe_eje_edkr´eedƒs’edƒ ed	ƒ e d	dejd ¡Zded< xq°W dS )
aY  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 http://msdn.microsoft.com/en-us/library/ms685049%28v=VS.85%29.aspx for a
similar example in C.
é    )ÚwintypesÚWINFUNCTYPENc             C   s$   | t jkrn| t jkrntdƒ dS )z8Handle a sig event and return 0 to terminate the processzUNKNOWN EVENTr   )ÚsignalZCTRL_C_EVENTZCTRL_BREAK_EVENTÚprint)Zsig© r   ú)/usr/lib/python3.7/win_console_handler.pyÚ_ctrl_handler   s    

r   Ú__main__é   z#Unable to add SetConsoleCtrlHandleréÿÿÿÿ)Ú__doc__Zctypesr   r   r   ZmmapÚsysZBOOLZDWORDZHandlerRoutiner   Zctrl_handlerZwindllZkernel32ZSetConsoleCtrlHandlerZargtypesZrestypeÚ__name__r   ÚexitÚargvÚmr   r   r   r   Ú<module>	   s&   


