
    f j                       U d dl mZ d dlmZmZmZm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mZmZmZ ddlmZ d	d
lmZ d	dlmZ eez  e
e         z  e
e         z  Zded<   ddeeddddd dddddddd5d1Zeeedddd ddddddd2d6d4ZdS )7    )annotations)AsyncIterableIterableMappingSequence)BytesIO)PathLike)PIPECalledProcessErrorCompletedProcess)IOAny	TypeAliascast   )Process   )get_async_backend)create_task_groupr   StrOrBytesPathNTF )inputstdinstdoutstderrcheckcwdenvstartupinfocreationflagsstart_new_sessionpass_fdsusergroupextra_groupsumaskcommand)StrOrBytesPath | Sequence[StrOrBytesPath]r   bytes | Noner   int | IO[Any] | Noner   r   r   boolr   StrOrBytesPath | Noner   Mapping[str, str] | Noner    r   r!   intr"   r#   Sequence[int]r$   str | int | Noner%   r&   Iterable[str | int] | Noner'   returnCompletedProcess[bytes]c               |  K   dfd}||t          d	          t          | |rt          n|||||||	|
|||||
           d{V 4 d{V 	 }ddgt                      4 d{V }|j        r|                    ||j        d           |j        r|                    ||j        d           |j        rA|r?|j                            |           d{V  |j        	                                 d{V  |
                                 d{V  ddd          d{V  n# 1 d{V swxY w Y   ddd          d{V  n# 1 d{V swxY w Y   \  }}|r5|j        dk    r*t          t          t          |j                  | ||          t          | t          t          |j                  ||          S )a  
    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

    streamAsyncIterable[bytes]indexr/   r3   Nonec                   K   t                      }| 2 3 d {V }|                    |           6 |                                |<   d S )N)r   writegetvalue)r6   r8   bufferchunkstream_contentss       mC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\anyio/_core/_subprocesses.pydrain_streamz!run_process.<locals>.drain_streamK   sn      ! 	  	  	  	  	  	  	 %LL " "(!2!2s   1Nz&only one of stdin and input is allowedr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r   r   )r6   r7   r8   r/   r3   r9   )
ValueErroropen_processr
   r   r   
start_soonr   r   sendaclosewait
returncoder   r   r/   r   )r(   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   rA   processtgoutputerrorsr?   s                        @r@   run_processrN      sM     v3 3 3 3 3 3  CU CABBB!&dd#+!         ! ! ! ! ! ! ! ! 
/3Tl$&& 	! 	! 	! 	! 	! 	! 	!"~ ?lGNA>>>~ ?lGNA>>>} - -m((/////////m**,,,,,,,,,,,..       	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!#! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !< %NFF Y#q( Y c7+=!>!>QWXXXGT#w/A%B%BFFSSSs7   E)B)D$E$
D.	.E1D.	2E
EErB   r   c                  K   i }|
|
|d<   |||d<   |||d<   |dk    r||d<    t                      j        | f|||||||||	d	| d{V S )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   rD   )r(   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   kwargss                  r@   rD   rD   z   s      b  F v  w '!&~z  w1"$$1#+              )"r(   r)   r   r*   r   r+   r   r+   r   r+   r   r,   r   r-   r   r.   r    r   r!   r/   r"   r,   r#   r0   r$   r1   r%   r1   r&   r2   r'   r/   r3   r4   )r(   r)   r   r+   r   r+   r   r+   r   r-   r   r.   r    r   r!   r/   r"   r,   r#   r0   r$   r1   r%   r1   r&   r2   r'   r/   r3   r   ) 
__future__r   collections.abcr   r   r   r   ior   osr	   
subprocessr
   r   r   typingr   r   r   r   abcr   
_eventloopr   _tasksr   strbytesr   __annotations__rN   rD   r   rQ   r@   <module>r^      s   " " " " " " " F F F F F F F F F F F F             A A A A A A A A A A + + + + + + + + + + + +       ) ) ) ) ) ) % % % % % %%K(3-7(5/I I I I I "&#'#'!%$(# !"/3#gT gT gT gT gT gTZ #'#'#'!%$(# !"/3J J J J J J J JrQ   