
    ܈ho                       % S SK Jr  S SKrS SKJrJrJrJr  S SKJ	r	  S SK
Jr  S SKJrJrJr  S SKJrJrJrJr  SS	KJr  S
SKJr  S
SKJr  \R6                  S:  a  S SKJr  OS SKJr  \\\SS4   r S\!S'   SS\\SSSSS SSSSSSS.                                 SS jjr"\\\SSSS SSSSSSS.                             SS jjr#g)    )annotationsN)AsyncIterableIterableMappingSequence)BytesIO)PathLike)PIPECalledProcessErrorCompletedProcess)IOAnyUnioncast   )Process   )get_async_backend)create_task_group)   
   )	TypeAliaszPathLike[str]zPathLike[bytes]r   StrOrBytesPathTF )inputstdinstdoutstderrcheckcwdenvstartupinfocreationflagsstart_new_sessionpass_fdsusergroupextra_groupsumaskc                 ^#    SU4S jjnUb  Ub  [        S5      e[        U U(       a  [        OUUUUUUU	U
UUUUUS9I Sh  vN  ISh  vN nSS/m[        5        ISh  vN nUR                  (       a  UR                  UUR                  S5        UR                  (       a  UR                  UUR                  S5        UR                  (       aL  U(       aE  UR                  R                  U5      I Sh  vN   UR                  R                  5       I Sh  vN   UR                  5       I Sh  vN   SSS5      ISh  vN   SSS5      ISh  vN   Tu  nnU(       a6  WR                  S:w  a&  [        [        [        UR                  5      U UU5      e[        U [        [        WR                  5      UU5      $  GN~ GNx GNd N N N N! , ISh  vN  (       d  f       N= f N! , ISh  vN  (       d  f       N= f7f)as  
Run an external command in a subprocess and wait until it completes.

.. seealso:: :func:`subprocess.run`

:param command: either a string to pass to the shell, or an iterable of strings
    containing the executable name or path and its arguments
:param input: bytes passed to the standard input of the subprocess
:param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
    a file-like object, or `None`; ``input`` overrides this
:param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
    a file-like object, or `None`
:param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
    :data:`subprocess.STDOUT`, a file-like object, or `None`
:param check: if ``True``, raise :exc:`~subprocess.CalledProcessError` if the
    process terminates with a return code other than 0
:param cwd: If not ``None``, change the working directory to this before running the
    command
:param env: if not ``None``, this mapping replaces the inherited environment
    variables from the parent process
:param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used
    to specify process startup parameters (Windows only)
:param creationflags: flags that can be used to control the creation of the
    subprocess (see :class:`subprocess.Popen` for the specifics)
:param start_new_session: if ``true`` the setsid() system call will be made in the
    child process prior to the execution of the subprocess. (POSIX only)
:param pass_fds: sequence of file descriptors to keep open between the parent and
    child processes. (POSIX only)
:param user: effective user to run the process as (Python >= 3.9, POSIX only)
:param group: effective group to run the process as (Python >= 3.9, POSIX only)
:param extra_groups: supplementary groups to set in the subprocess (Python >= 3.9,
    POSIX only)
:param umask: if not negative, this umask is applied in the child process before
    running the given command (Python >= 3.9, POSIX only)
:return: an object representing the completed process
:raises ~subprocess.CalledProcessError: if ``check`` is ``True`` and the process
    exits with a nonzero return code

c                   >#    [        5       nU   S h  vN nUR                  U5        M   N
 UR                  5       TU'   g 7f)N)r   writegetvalue)streamindexbufferchunkstream_contentss       AD:\TimeStamps\venv\Lib\site-packages\anyio/_core/_subprocesses.pydrain_stream!run_process.<locals>.drain_streamQ   s=     ! 	 %LL	 6 "(!2s   A.,.A.ANz&only one of stdin and input is allowedr   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r   r   )r/   zAsyncIterable[bytes]r0   intreturnNone)
ValueErroropen_processr
   r   r   
start_soonr   r   sendaclosewait
returncoder   r   r8   r   )commandr   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r5   processtgoutputerrorsr3   s                        @r4   run_processrG      s    v3 U.ABB!d#+!    
/3Tl$&&"~~lGNNA>~~lGNNA>}}mm((///mm**,,,,,.   '&# < %NFF##q( c7+=+=!>QWXXGT#w/A/A%BFFSSE" ' 0,  '&&&#   s   A HGHGHG.#G$G.'BG:G
;!GGG4G5G9G.GG.	HG,A-HHG.
GGGG.G)	GG)	%G.,H.H4G75HHr7   c                  #    0 nU
b  XS'   Ub  XS'   Ub  XS'   US:  a  XS'   [        5       R                  " U 4UUUUUUUUU	S.	UD6I Sh  vN $  N7f)a  
Start an external command in a subprocess.

.. seealso:: :class:`subprocess.Popen`

:param command: either a string to pass to the shell, or an iterable of strings
    containing the executable name or path and its arguments
:param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a
    file-like object, or ``None``
:param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
    a file-like object, or ``None``
:param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
    :data:`subprocess.STDOUT`, a file-like object, or ``None``
:param cwd: If not ``None``, the working directory is changed before executing
:param env: If env is not ``None``, it must be a mapping that defines the
    environment variables for the new process
:param creationflags: flags that can be used to control the creation of the
    subprocess (see :class:`subprocess.Popen` for the specifics)
:param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used
    to specify process startup parameters (Windows only)
:param start_new_session: if ``true`` the setsid() system call will be made in the
    child process prior to the execution of the subprocess. (POSIX only)
:param pass_fds: sequence of file descriptors to keep open between the parent and
    child processes. (POSIX only)
:param user: effective user to run the process as (POSIX only)
:param group: effective group to run the process as (POSIX only)
:param extra_groups: supplementary groups to set in the subprocess (POSIX only)
:param umask: if not negative, this umask is applied in the child process before
    running the given command (POSIX only)
:return: an asynchronous process object

Nr'   r(   r)   r   r*   )	r   r   r   r!   r"   r#   r$   r%   r&   )r   r<   )rB   r   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   kwargss                  r4   r<   r<      s     b  Fvw!&~zw"$11#+    s   A
AAA)"rB   )StrOrBytesPath | Sequence[StrOrBytesPath]r   zbytes | Noner   int | IO[Any] | Noner   rK   r   rK   r    boolr!   StrOrBytesPath | Noner"   Mapping[str, str] | Noner#   r   r$   r8   r%   rL   r&   Sequence[int]r'   str | int | Noner(   rP   r)   Iterable[str | int] | Noner*   r8   r9   zCompletedProcess[bytes])rB   rJ   r   rK   r   rK   r   rK   r!   rM   r"   rN   r#   r   r$   r8   r%   rL   r&   rO   r'   rP   r(   rP   r)   rQ   r*   r8   r9   r   )$
__future__r   syscollections.abcr   r   r   r   ior   osr	   
subprocessr
   r   r   typingr   r   r   r   abcr   
_eventloopr   _tasksr   version_infor   typing_extensionsstrbytesr   __annotations__rG   r<   r       r4   <module>rb      s,   " 
 F F   A A ' '  ) %w +!#uo?P"PQ	 Q "&#'#'!%$(# !"/3#gT6gT gT  	gT
 !gT !gT gT 
gT 
"gT gT gT gT gT gT gT  -!gT" #gT$ %gTZ #'#'#'!%$(# !"/3J6J  J !	J
 !J 
J 
"J J J J J J J -J J  !Jra   