Ë
    @Øïic	  ã            
       óð   — d Z ddlZddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ  ej                  «         ej                  d«      Zded	ed
   de	e   defd„Zded	ed
   de	e   de
e   ddf
d„Zy)ze
Some light wrappers around Python's multiprocessing, to deal with cleanly
starting child processes.
é    N)ÚSpawnProcess)Úsocket)ÚCallableÚListÚOptional)ÚConfigÚspawnÚconfigÚtarget).NÚsocketsÚreturnc                 ó¦   — 	 t         j                  j                  «       }| |||dœ}t        j                  t        |¬«      S # t        $ r d}Y Œ/w xY w)aÔ  
    Called in the parent process, to instantiate a new child process instance.
    The child is not yet started at this point.

    * config - The Uvicorn configuration instance.
    * target - A callable that accepts a list of sockets. In practice this will
               be the `Server.run()` method.
    * sockets - A list of sockets to pass to the server. Sockets are bound once
                by the parent process, and then passed to the child processes.
    N©r
   r   r   Ústdin_fileno)r   Úkwargs)ÚsysÚstdinÚfilenoÚOSErrorr	   ÚProcessÚsubprocess_started)r
   r   r   r   r   s        úM/var/www/html/aiagents/fe/lib/python3.12/site-packages/uvicorn/_subprocess.pyÚget_subprocessr      sZ   € ð$Ü—y‘y×'Ñ'Ó)ˆð
 ØØØ$ñ	€Fô �=‰=Ô 2¸6ˆ=ÓBÐBøô ò ØŠðús   ‚A ÁAÁAr   c                 óv   — |�t        j                  |«      t        _        | j	                  «         ||¬«       y)aú  
    Called when the child process starts.

    * config - The Uvicorn configuration instance.
    * target - A callable that accepts a list of sockets. In practice this will
               be the `Server.run()` method.
    * sockets - A list of sockets to pass to the server. Sockets are bound once
                by the parent process, and then passed to the child processes.
    * stdin_fileno - The file number of sys.stdin, so that it can be reattached
                     to the child process.
    N)r   )ÚosÚfdopenr   r   Úconfigure_loggingr   s       r   r   r   3   s2   € ð$ ÐÜ—I‘I˜lÓ+ŒŒ	ð ×ÑÔñ �7Öó    )Ú__doc__Úmultiprocessingr   r   Úmultiprocessing.contextr   r   Útypingr   r   r   Úuvicorn.configr   Úallow_connection_picklingÚget_contextr	   r   Úintr   © r   r   ú<module>r(      s¼   ðñó Û 	Û 
Ý 0Ý ß +Ñ +å !à )€× )Ñ )Ô +Ø#ˆ×#Ñ# GÓ,€ðCØðCà�YÑðCð �&‰\ðCð ó	CðBØðà�YÑðð �&‰\ðð ˜3‘-ð	ð
 
ôr   