
    $g                        d dl mZ d dlZd dlmZ d dlmZ er
d dlZd dlmZ  ej	        e
          Z G d de          ZdS )    )annotationsN)TYPE_CHECKING)
BaseThread)Callablec                  (     e Zd Zd	 fdZd
dZ xZS )ProcessWatcher	popen_objsubprocess.Popenprocess_termination_callbackCallable[[], None] | NonereturnNonec                d    t                                                       || _        || _        d S )N)super__init__r	   r   )selfr	   r   	__class__s      ^/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/watchdog/utils/process_watcher.pyr   zProcessWatcher.__init__   s.    ",H)))    c                l   | j                                         6| j                            d          rd S | j                                         6	 | j                                        s| j        r|                                  d S d S d S # t          $ r t                              d           Y d S w xY w)Ng?)timeoutz*Error calling process termination callback)	r	   pollstopped_eventwaitis_setr   	Exceptionlogger	exception)r   s    r   runzProcessWatcher.run   s    n!!##+!&&s&33  n!!##+	K%,,.. 443T 411333334 4 4 4 	K 	K 	KIJJJJJJ	Ks   4B $B32B3)r	   r
   r   r   r   r   )r   r   )__name__
__module____qualname__r   r   __classcell__)r   s   @r   r   r      s_        I I I I I I
	K 	K 	K 	K 	K 	K 	K 	Kr   r   )
__future__r   loggingtypingr   watchdog.utilsr   
subprocessr   	getLoggerr    r   r    r   r   <module>r+      s    " " " " " "              % % % % % %  		8	$	$K K K K KZ K K K K Kr   