
    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y)    )annotationsN)TYPE_CHECKING)
BaseThread)Callablec                  (     e Zd Zd fdZddZ xZS )ProcessWatcherc                >    t         |           || _        || _        y )N)super__init__	popen_objprocess_termination_callback)selfr   r   	__class__s      S/var/www/openai/venv/lib/python3.12/site-packages/watchdog/utils/process_watcher.pyr   zProcessWatcher.__init__   s    ",H)    c                b   | j                   j                         8| j                  j                  d      ry | j                   j                         8	 | j                  j	                         s| j
                  r| j                          y y y # t        $ r t        j                  d       Y y 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    nn!!#+!!&&s&3 nn!!#+	K%%,,.43T3T113 4U. 	KIJ	Ks   6B B.-B.)r   zsubprocess.Popenr   zCallable[[], None] | NonereturnNone)r   r   )__name__
__module____qualname__r   r   __classcell__)r   s   @r   r   r      s    I
	Kr   r   )
__future__r   loggingtypingr   watchdog.utilsr   
subprocessr   	getLoggerr   r   r    r   r   <module>r)      s:    "    %			8	$KZ Kr   