
    g
                        S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  \R                  " 5         \R                  " S5      r        SS	 jr          SS
 jrg)ze
Some light wrappers around Python's multiprocessing, to deal with cleanly
starting child processes.
    )annotationsN)SpawnProcess)socket)Callable)Configspawnc                     [         R                  R                  5       nU UUUS.n[
        R                  [        US9$ ! [        [        4 a    Sn N3f = f)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configtargetsocketsstdin_fileno)r   kwargs)sysstdinfilenoAttributeErrorOSErrorr   Processsubprocess_started)r   r   r   r   r   s        L/home/matz/Project1/venv/lib/python3.13/site-packages/uvicorn/_subprocess.pyget_subprocessr      s_    "yy'') $	F == 26=BB G$ s   ? AAc                    Ub  [         R                  " U5      [        l        U R	                  5          U" US9  g! [
         a     gf = f)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_loggingKeyboardInterruptr
   s       r   r   r   6   sI    $ IIl+	 w  	s   ; 
AA)r   r   r   Callable[..., None]r   list[socket]returnr   )
r   r   r   r   r   r   r   z
int | Noner    None)__doc__
__future__r   multiprocessingr   r   multiprocessing.contextr   r   typingr   uvicorn.configr   allow_connection_picklingget_contextr   r   r        r   <module>r,      s   
 #  	 
 0   !  ) ) +##G,CCC C 	CB  	
 
r+   