o
    h                     @  sb   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	e
ZG dd deZdS )    )annotationsN)TYPE_CHECKING)
BaseThread)Callablec                      s(   e Zd Zd fddZdd	d
Z  ZS )ProcessWatcher	popen_objsubprocess.Popenprocess_termination_callbackCallable[[], None] | NonereturnNonec                   s   t    || _|| _d S )N)super__init__r   r	   )selfr   r	   	__class__ R/var/www/vscode/kcb/lib/python3.10/site-packages/watchdog/utils/process_watcher.pyr      s   

zProcessWatcher.__init__c                 C  sx   | j  d u r| jjddrd S | j  d u sz| j s'| jr*|   W d S W d S W d S  ty;   td Y d S w )Ng?)timeoutz*Error calling process termination callback)	r   pollstopped_eventwaitis_setr	   	Exceptionlogger	exception)r   r   r   r   run   s   zProcessWatcher.run)r   r   r	   r
   r   r   )r   r   )__name__
__module____qualname__r   r   __classcell__r   r   r   r   r      s    r   )
__future__r   loggingtypingr   watchdog.utilsr   
subprocessr   	getLoggerr   r   r   r   r   r   r   <module>   s    
